View Full Version : Help with loading in iframes.
Ranger56
03-22-2005, 01:50 AM
What's the javascript to make links that are clicked in the navbar, open in the iframe?
glenngv
03-22-2005, 02:04 AM
Can be done without javascript, just plain HTML.
<a href="thepage.html" target="nameOfTheIframe">link</a>
Ranger56
03-22-2005, 02:51 AM
For some reason, that wouldnt work for me, so I used,
<script type="text/javascript">
function loadIframe(iframeName, url) {
if ( window.frames[iframeName] ) {
window.frames[iframeName].location = url;
return false;
}
else return true;
}
then
<A HREF="url" TITLE="title" onclick="return loadIframe('frame', this.href)"><IMG ALT="alt" SRC="img.url" WIDTH="" BORDER="" HEIGHT=""></A>
Thanks anyways though.
Scootertaj
03-22-2005, 03:03 AM
Although it sounds like it worked, you might want to find a non-javascript alternative, as some ppl have javascript disabled and it will make your site look nothing like what it looks like for someone with javascript enabled :)
glenngv
03-22-2005, 04:05 AM
For some reason, that wouldnt work for me, so I used,
It should work. Did you specify the name (not the id) of the iframe in the target?
As Scootertaj mentioned, you should provide a non-javascript alternative as it can be disabled. And my suggested solution is the answer.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.