Click to See Complete Forum and Search --> : Change layer visibility between two frames


spiderbo
03-19-2003, 06:34 AM
Hi,

I have two framesets:

index.htm
|
----------------------
| |
index_nav.htm index_main.htm
(index_nav) (index_main)
Call to hidden layers |
|
-----------------
| |
nav.htm main.htm
(nav) (main)
hidden layers


The frame names are in brackets underneath the document names.

If I put the following javascript in index_nav.htm,
Code:
var doCheck = (top.parent.main.document.all!=null);


I get
Code:
"Error: 'top.parent.main.document' is null or not an object".


If I put a call to the hidden layers within the same frameset (nav.htm), I don't get any errors, i.e.,
Code:
var doCheck = (parent.main.document.all!=null);



Can anyone help? I seem to have tried every combination; parent.parent..., parent.frames[1]... and still keep getting errors.

spiderbo
03-19-2003, 07:27 AM
Thank you for your response, I tried it and still receive the same error: "'top.main.document' is null or not an object".

Any more ideas?

spiderbo
03-19-2003, 07:54 AM
The frame has definately loaded,

Have a look at the following really simple code:

http://www.osmis.com/javascript/index9.htm

You will see that the top frame INDEX_NAV, which is a parent to the MAIN frame does not work, however, the left hand frame NAV frame, which is in the same frame set as MAIN does work.

khalidali63
03-19-2003, 08:02 AM
Check this link out,may be thats what you need..

:D

http://68.145.35.86/temp/spiderbo/index.html

Cheers

Khalid

pyro
03-19-2003, 08:03 AM
It looks like you named your lower frame index_main...

spiderbo
03-19-2003, 08:08 AM
first frame set (index9.htm):
<FRAMESET rows="100,*" FRAMEBORDER=1 BORDER=1>
<FRAME NAME="index_nav" SRC="NAVpage9.html">
<FRAME NAME="index_main" SRC="MAINpage9.html">
</FRAMESET>


second frame set(MAINpage9.html):
<FRAMESET cols="200,*" FRAMEBORDER=1 BORDER=1>
<FRAME NAME="nav" SRC="index_main.htm">
<FRAME NAME="main" SRC="FirstMainPage9.html">
</FRAMESET>

pyro
03-19-2003, 08:21 AM
So, it looks like you need to reference it like this, in your top frame:

top.index_main.main.document...

spiderbo
03-19-2003, 08:38 AM
Thank you pyro, you have saved me hours of work, you are a genius!

Thanks also to Khalid, yours looked like it would have worked too, just a little more complicated.