Click to See Complete Forum and Search --> : Change bg image in frame 1 from frame 2 each time #2 changes


agminer
05-13-2003, 05:16 PM
I am working on a comercial web page and want to change the background image in frame #1 (to match #2) each time frame #2 changes. Frame #1 is a menu with buttons and I don't want to reload #1 each time #2 changes.

Jona
05-13-2003, 11:08 PM
Left frame:

<html><head>
<title></title>
<script type="text/javascript">
//preload images
bg1=new Image();bg1.src="bg1.jpg";bg2=new Image();bg2.src="bg2.jpg";
function changeBG(x){
top.rightFrameName.document.backgroundImage=bg[x].src;
}
</script></head>
<body>
</body></html>

Right frame:

<html><head>
<title></title>
</head><body onunload="parent.leftFrameName.changeBG(1)" onload="parent.leftFrameName.changeBG(2)">
</body></html>

This will make the bg image on frame two bg2.jpg onload, and the next page will have bg1.jpg as the background (I think).

agminer
05-13-2003, 11:59 PM
I tried it and it did not work for me. :( Might just be me but I am not sure.

By the way I do want to maintain compatability back to Netscape 4.

Jona
05-14-2003, 10:56 AM
Whoa.... NN4? I don't have it, so I can't really test in it. But the logic looks good to me. ;) Try parent.rightFrameName.document.backgroundImage.src=bg[x].src