Click to See Complete Forum and Search --> : Change src of frame


Dumbass
11-22-2003, 12:40 AM
<frameset cols="147,553" border="0" frameborder="0">
<frame name="mainMenu" src="mainmenu.html" scrolling="no" noresize>
<frameset rows="100,300 border="0" frameborder="0">
<frame name="header" src="header.html" scrolling="no" noresize>
<frameset cols="409,144" border="0" frameborder="0">
<frameset rows="287,13" border="0" frameborder="0">
<frame name="main" src="home.html" noresize>
<frame name="copyright" src="copyright.html" scrolling="no" noresize>
</frameset>
<frame name="subMenu" src="submenu.html" scrolling="no" noresize>
</frameset>
</frameset>
</frameset>

... Don't ask why there's so many framesets.

Anyway, in mainmenu.html (which is in the mainMenu frame), I have an onClick that calls the following function:

function menuClick(mainURL)
{
// Temporary alert to make sure function is actually called
alert('menuClick is working');

if(mainURL!="")
{
main.src = mainURL;
}
}


Basically, the alert works, but main.src doesn't change. I tried changing to parent.main.src, but still no change. Any ideas?

IzzieLeeLucas
11-22-2003, 06:55 AM
Hi there,

Correct me if I'm wrong, but I assume all you want to do is change which doument is displayed in the Main frame.

If so, this should work... (in the mainmenu.html)

<script>
function menuClick(mainURL){
alert('menuClick is working');
top.main.document.location = mainURL;
}
</script>

and for the onClick... onClick="menuClick('document.html')"

Izzie

Dumbass
11-22-2003, 07:24 AM
Thanks so much!