Forum Moderators: open
Basically on my site i have a navigation image map, and 3 i-frames. [menu] [main big] [extras].
What im trying to accomplish is OnClicking the menu say "Links" it will load a page in iframe1 and iframe2 (different pages). the 3rd is fine to not change. I appreciate you taking time and im not very great at javascript so basic instructions would be good, although im not a tard either :)
code here
[webmasterworld.com...]
I was just looking at that other thread rico, funny you should repost at this very moment. I will admit my javascript is not 100% but could you call a function that changed the 2 frames maybe? I figure you could pass the function the 2 pages that are to be loaded into the frames and the function could switch them for you.
make any sense?
[webmasterworld.com...]
basically same errors.
I started with your code. In your example you have the javascript in the wrong file from what I worked out. I used a 1st file called frametest.html all it has in it is this
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF" scroll="no">
<div style="position: absolute; top:235; left:128">
<iframe FRAMEBORDER="0" BORDER=0 marginwidth=0 marginheight=0 hspace=0 vspace=0 width=124 height=320 src="1.html" name=1 allowTransparency scrolling=auto style="FILTER: chroma (color=40FF40)"></iframe>
</div>
<div style="position: absolute; top:235; left:267">
<iframe FRAMEBORDER="0" BORDER=0 marginwidth=0 marginheight=0 hspace=0 vspace=0 width=486 height=320 src="2.html" name=2 allowTransparency scrolling=auto style="FILTER: chroma (color=40FF40)"></iframe>
</div>
<div style="position: absolute; top:235; left:767">
<iframe FRAMEBORDER="0" BORDER=0 marginwidth=0 marginheight=0 hspace=0 vspace=0 width=124 height=320 src="3.html" name=3 allowTransparency scrolling=auto style="FILTER: chroma (color=40FF40)"></iframe>
</div>
</BODY>
</HTML>
which is your frame code. I don't have the images or files so there are all kinds of 404's. The only file I created was 3.html which would be where your menu is and it has this
<HTML>
<HEAD>
<TITLE>some title</TITLE>
<script>
function twoFrameChange(left,middle){
parent.frames[0].location.href = left;
parent.frames[1].location.href = middle;
}
</script>
</HEAD>
<BODY bgcolor="#FFFFFF" scroll="no">
<p><A HREF="javascript:twoFrameChange('itsover.html','getup.html');">click it</a>
</BODY>
</HTML>
so it now has a working function in the head portion. Part of the problem is you used numbers for your frame name and that is confusing it. I accessed the via the frames array. Your 1 frame is the first on the page so I used
parent.frames[0].location.href = left;
this means in the parent page (because the frame needs to access the frames array of the top level page) change the location of the first frame to the value of the variable 'left' which is 'itsover.html'. All arrays start with 0 being the first element.
make any sense?
Part of the problem is you used numbers for your frame name and that is confusing it.
[w3.org...]
Something to bear in mind if you want to avoid creating other potential problems.