mothra
08-03-2003, 04:18 AM
I'm having some problems that I believe are related to the lastChild property. The browsers I'm testing with are IE6 & NN7.
I wrote a simple javascript to hide/show a DIV, it works fine in IE, but not in NN. While debugging I added a temporary ID to the DIV I wanted to show and used getElementById - this worked, leading me to believe there is an issue with lastChild. My other thought is that there is a problem with the way I'm passing the element into the function.
Here is a small snippet of the layout & code, the css is not shown but as I mentioned it does work when I use the DIV ID so I assume the css is ok... I don't know how to keep my indented formatting, sorry about the readability.
<div class="menuHead" onmouseover="showMenu(this)" onmouseout="hideMenu(this)">Main 1
<div class="subMenu" id="menu2">
<div class="menuItem" onmouseover="menuItemOver(this)" onmouseout="menuItem(this)">Item 1</div>
<div class="menuItem" onmouseover="menuItemOver(this)" onmouseout="menuItem(this)">Item 2</div>
<div class="menuItem" onmouseover="menuItemOver(this)" onmouseout="menuItem(this)">Item 3</div>
</div>
</div>
...and the script
function showMenu(eID){
eID.lastChild.className = "subMenuVisible";
//var shat = document.getElementById('menu2');
//shat.className = "subMenuVisible";
}
function hideMenu(eID){
eID.lastChild.className = "subMenu";
//var shat = document.getElementById('menu2');
//shat.className = "subMenu";
}
please help!
I wrote a simple javascript to hide/show a DIV, it works fine in IE, but not in NN. While debugging I added a temporary ID to the DIV I wanted to show and used getElementById - this worked, leading me to believe there is an issue with lastChild. My other thought is that there is a problem with the way I'm passing the element into the function.
Here is a small snippet of the layout & code, the css is not shown but as I mentioned it does work when I use the DIV ID so I assume the css is ok... I don't know how to keep my indented formatting, sorry about the readability.
<div class="menuHead" onmouseover="showMenu(this)" onmouseout="hideMenu(this)">Main 1
<div class="subMenu" id="menu2">
<div class="menuItem" onmouseover="menuItemOver(this)" onmouseout="menuItem(this)">Item 1</div>
<div class="menuItem" onmouseover="menuItemOver(this)" onmouseout="menuItem(this)">Item 2</div>
<div class="menuItem" onmouseover="menuItemOver(this)" onmouseout="menuItem(this)">Item 3</div>
</div>
</div>
...and the script
function showMenu(eID){
eID.lastChild.className = "subMenuVisible";
//var shat = document.getElementById('menu2');
//shat.className = "subMenuVisible";
}
function hideMenu(eID){
eID.lastChild.className = "subMenu";
//var shat = document.getElementById('menu2');
//shat.className = "subMenu";
}
please help!