Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Layers?

Status
Not open for further replies.

jchastai

Programmer
Oct 11, 2001
31
0
0
US
I have a javascript problem that I am needing some help with. I pulled the following code example (slighly modified) from a book and I am having some problems getting it to do what I am looking for.

-------------

<div id=&quot;menuFrame&quot; class=&quot;menuFrame&quot;>
<table class=&quot;menuFrame&quot; width=&quot;160&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td id=&quot;menuItem1&quot; class=&quot;menuItem&quot; onmouseover=&quot;this.style.backgroundColor = 'navy'; this.style.color = 'white';&quot; onmouseout=&quot;this.style.backgroundColor = ''; this.style.color = 'black';&quot;>
<ilayer>
<layer id=&quot;menuItem1&quot; class=&quot;menuItem&quot; width=&quot;100%&quot; onmouseover=&quot;this.bgColor = 'navy'; this.color = 'white';&quot; onmouseout=&quot;this.bgColor = '#D4D0C8'; this.color = 'black';&quot;>
Menu Item 1
</layer>
</ilayer>
</td>
</tr>
</table>
</div>

-------------

I guess my first question is, could I not do this same thing using a pair of nested <div> tags and still have it work in all browsers - IE 4+, NS4, N6+??

Second, how do I go about referencing the inner layer when using NS4? I need to refer to it in a function and I have tried both:

document.layers.menuFrame.document.layers.menuItem1
document.menuFrame.document.menuItem1

and I am getting the standard &quot;document.... has no properties&quot; error message.

All help would be appreciated.
-- Jeff
 
[COLOR=aa0000]
Code:
document.menuFrame.document.layers[0].document.menuItem1
[/color]

That is, if [COLOR=aa0000]
Code:
menuFrame
[/color] is absolutely or relatively positioned. If it isn't positioned so, you'll have to access the ilayer as a direct child of the [COLOR=aa0000]
Code:
document
[/color].
Code:
- UNIMENT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top