html - 1 iframe 2 button's with onclick JavaScript -



html - 1 iframe 2 button's with onclick JavaScript -

i've been working on 3 hours now.. can't figure out why it's not working.

the first button should open iframe, does. sec should same. somewhy it's not willing so!

here code:

<body> <input type="button" id="knopsql1" type="submit" value="1e klasse"></input> <script> document.getelementbyid('knopsql1').onclick = function() { var iframe = frames[0] || document.createelement('iframe'); iframe.src='http://www.example.com/sql.php'; document.body.appendchild(iframe); }; </script> <input type="button" id="knopsql2" type="submit" value="2e klasse"></input> <script> document.getelementbyid('knopsql2').onclick = function() { var iframe = document.createelement('iframe'); iframe.src'http://www.example.com/sql2.php'; document.body.appendchild(iframe); }; </script> </body>

check code of sec script

iframe.src'http://www.example.com/sql2.php';

should

iframe.src ='http://www.example.com/sql2.php';

you missing '=' operator

javascript html iframe

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -