Helpful Information
 
 
Category: DOM and JSON scripting
Frames (dom de dom dom)...

Ugh. Getting my head in a right mess here.

Got the following frameset/s:



<frameset rows="63,*,31" frameborder=0 framespacing=0>
<frame name="fmTopbar" src="topbar.html" frameborder=0 framespacing=0 height=63 marginheight=0 marginwidth=0 scrolling="no">
<frameset cols="159,625" frameborder=0 framespacing=0>
<frame name="fmMenu" src="menu.html" frameborder=0 framespacing=0 width=159 marginheight=0 marginwidth=0 scrolling="auto">
<frame name="fmContent" src="home.html" frameborder=0 framespacing=0 width=625 marginheight=0 marginwidth=0 scrolling="auto">
</frameset>
<frame name="fmBottombar" src="bottombar.html" frameborder=0 framespacing=0 height=31 marginheight=0 marginwidth=0 scrolling="no">
</frameset>


Now, I want to put an onLoad handler in the body tag of "home.html" (that loads into fmContent) that, when called, will reload "menu.html" into fmMenu.

Something along the lines of:

onLoad="window.parent.fmMenu.document.reload()"

is that right? Did I miss something stoopid? Do I need to have some weird reccurring "window.parent.window.parent" type-thing going on with embedded framesets? Or am I simply barking up the wrong tree?

Ta :)

Well, when working with frame references like you are here, I always prefer to use an absolute reference to the frame, and include the frames collection

top.frames['fmMenu'].location.reload();

However, since there is only 1 parent document, then this would work as well

parent.frames['fmMenu'].location.reload();

You will also notice that the reload() method is exposed to the window object's location object, and not to the document object.

Remember here that parent is a reference to the parent window and NOT the parent frameset










privacy (GDPR)