Click to See Complete Forum and Search --> : adressing "nested" layers in script


drek
03-26-2003, 07:51 AM
Hi all,

how do i correctly adress a layer within another layer?
My Example:
layer id="topic" is in layer with the id="main"

for ns4 i tried:
rulerT = document.main.document.topic;

for ie i thought of:
rulerT = document.all.main.style.document.all.topic.style.;

and for DOM:
rulerT = parseInt(document.getElementById("topic").style);

but it doesn´t work???
where is the mistake???

_drek

AdamBrill
03-26-2003, 08:47 AM
Try this:

rulerT = document.getElementById("topic").style;

That will return the style object of the "topic" layer. I hope that helps! :)

havik
03-26-2003, 09:35 AM
for ns4 try:

rulerT = document.layers.['main'].document.layers.['topic'];

if not, then try it with parent. at the beginning.

for IE try:

rulerT = document.all['topic'];

for DOM try:

rulerT = document.getElementById("topic");

havik