thecard Posted August 22, 2008 Share Posted August 22, 2008 HERE is the full code: <html> <title>User's Nice HTML Page</title> </head> <body> <script type="text/javascript"> window.onload = doit(window.location); function doit(dom) { document.getElementById("boa").scr = "frame.php?dom=" + dom; } </script> <iframe name="iframe1" id="boa" align="top" height="100" width="400" hspace="10" vspace="10"> </iframe> </body> </html> Frame.php: <? $dom = $_GET['dom']; echo"DOMAIN IS $dom"; ?> All that is outputted is a blank iframe (frame.php is not even loaded into it)! Why doesn't frame.php get loaded into the iframe? :'( Link to comment https://forums.phpfreaks.com/topic/120879-solved-something-wrong-with-setting-scr-with-getelementbyid/ Share on other sites More sharing options...
lemmin Posted August 22, 2008 Share Posted August 22, 2008 The HTML isn't parsed yet when the window loads. Try putting the onload into the body tag: <body onload="doit(window.location);"> Link to comment https://forums.phpfreaks.com/topic/120879-solved-something-wrong-with-setting-scr-with-getelementbyid/#findComment-623114 Share on other sites More sharing options...
thecard Posted August 22, 2008 Author Share Posted August 22, 2008 That didn't work.. Link to comment https://forums.phpfreaks.com/topic/120879-solved-something-wrong-with-setting-scr-with-getelementbyid/#findComment-623178 Share on other sites More sharing options...
lemmin Posted August 22, 2008 Share Posted August 22, 2008 Put your script tag in the head: <html> <head> <title>User's Nice HTML Page</title> <script type="text/javascript"> function doit(dom) { document.getElementById("boa").scr = "frame.php?dom=" + dom; } </script> </head> <body onload="doit(window.location)"> <iframe name="iframe1" id="boa" align="top" height="100" width="400" hspace="10" vspace="10"> </iframe> </body> </html> Link to comment https://forums.phpfreaks.com/topic/120879-solved-something-wrong-with-setting-scr-with-getelementbyid/#findComment-623205 Share on other sites More sharing options...
thecard Posted August 22, 2008 Author Share Posted August 22, 2008 Didn't work! this is really annoying! Link to comment https://forums.phpfreaks.com/topic/120879-solved-something-wrong-with-setting-scr-with-getelementbyid/#findComment-623208 Share on other sites More sharing options...
thecard Posted August 22, 2008 Author Share Posted August 22, 2008 Found the error: Just a typo: Instead of src, I put scr. Dam. Here's the correct script: <html> <head> <title>User's Nice HTML Page</title> <script type="text/javascript"> function doit(dom) { document.getElementById("boa").src = "frame.php?dom=" + dom; } </script> </head> <body onload="doit(window.location)"> <iframe name="iframe1" id="boa" align="top" height="100" width="400" hspace="10" vspace="10"> </iframe> </body> </html> Link to comment https://forums.phpfreaks.com/topic/120879-solved-something-wrong-with-setting-scr-with-getelementbyid/#findComment-623210 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.