jim447
11-20-2010, 01:11 AM
Hello. I have built a basic website that contains an iframe in the middle, called "iframe1". In this iframe I wish to load an external message board from proboards.com. In my code I can easily do this by making a button or hyper-link with the href="http:proboards.com/myforums" and the target="iframe1"
When I do this it will load inside of it the iframe jsut as I want it to. However, my the problem is when you click on the button to login its coded to target "_top" and it opens on the entire page replacing the whole website. If i run firebug (a real time HTML editor). I can easily locate and change the link code to target="iframe1". But How can I write a script in javascript in my webpage code to do this as soon as the iframe has loaded the external messageboard?
I have also been trying things like
javascript:void(document.iframe1.getElementsByTag("a")[5].target="iframe1")
but i have had no luck so far in changing the target without the aid of firebug.
Here is the code that needs to be changed. the target="_top" needs to be altered somehow to target="iframe1" as soon as the frame has finished loading the messageboards.
<p><font size="2">
Welcome Guest. Please <a href="/index.cgi?action=login" target="_top">Login</a> or <a href="/index.cgi?action=register" target="_top">Register</a>.<br/>Nov 19, 2010, 7:23pm
</font><br /></p>
Heres a screenshot that may help, as you can see I have easily changed the target of the link to="iframe1" using firebug, but I need to hardcode a script in my website that does this automatically after the iframe has loaded the forums page.
http://img191.imageshack.us/img191/7264/26796014.jpg
Thanks to for any help.
When I do this it will load inside of it the iframe jsut as I want it to. However, my the problem is when you click on the button to login its coded to target "_top" and it opens on the entire page replacing the whole website. If i run firebug (a real time HTML editor). I can easily locate and change the link code to target="iframe1". But How can I write a script in javascript in my webpage code to do this as soon as the iframe has loaded the external messageboard?
I have also been trying things like
javascript:void(document.iframe1.getElementsByTag("a")[5].target="iframe1")
but i have had no luck so far in changing the target without the aid of firebug.
Here is the code that needs to be changed. the target="_top" needs to be altered somehow to target="iframe1" as soon as the frame has finished loading the messageboards.
<p><font size="2">
Welcome Guest. Please <a href="/index.cgi?action=login" target="_top">Login</a> or <a href="/index.cgi?action=register" target="_top">Register</a>.<br/>Nov 19, 2010, 7:23pm
</font><br /></p>
Heres a screenshot that may help, as you can see I have easily changed the target of the link to="iframe1" using firebug, but I need to hardcode a script in my website that does this automatically after the iframe has loaded the forums page.
http://img191.imageshack.us/img191/7264/26796014.jpg
Thanks to for any help.