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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown Menu Making it work in IE 1

Status
Not open for further replies.

robert89

Technical User
Nov 19, 2003
125
CA
Hi there,
I have a piece of javascript that helps the functioning of css dropdown in i.e. The script uses getElementByID. The element being <ul id="nav">

I have placed this list in a left div and adjusted the css formatting of the list to affect only the ul in the left div. The javascript does not function. How do I have the script below call call/make reference to the <ul id="nav"> within the left div.

<script language="javascript" type="text/javascript">
<!--
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes;
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;
//-->
</script>

Help appreciated.

Bob
 
If your "left div" is meant for "left frame", you can try this using index (supposing it is 0 for left, 1 for right).
[tt]
>navRoot = document.getElementById("nav");
navRoot = [red]window.frames[0].[/red]document.getElementById("nav");
[/tt]
or using its name like this.
[tt]
navRoot = [red]window.frames["left_frame_name"].[/red]document.getElementById("nav");
[/tt]
Otherwise, there is no reason for document.getElementById("nav") by itself not working except your id is not unique.
 
Hi Tsuji,
Thanks for the suggestion. I am actually using layers. The layer I've placed the menu in is called "left". Having said this, turns out that there was once piece of coding in the original css that I failed to identify as #left. Once I identified the piece of css properly, the menu worked fine.

Once again, thanks for taking time to help.

Regards,
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top