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

Simple Drop menu problem

Status
Not open for further replies.

bigpapaguru

Instructor
Jan 26, 2005
4
US
I have a page with two different navigation elements one that is horizontal on the top of the page, and one that is verticle on the left side of the site.

To make the drop downs I followed the tutorial here
========= MY PROBLEM =========
I named the top drop down "1nav" and the side drop down "2nav"

When I use this script the last getElementById in the script is the only menu that will work in my site. Something seems to cancle out the top function.

If anyone could help it would be much appreciated.

Thanks
Matt

// JavaScript Document

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("1nav");
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;


startList2 = function() {
if (document.all&&document.getElementById) {
navRoot2 = document.getElementById("2nav");
for (i=0; i<navRoot2.childNodes.length; i++) {
node2 = navRoot2.childNodes;
if (node2.nodeName=="LI") {
node2.onmouseover=function() {
this.className+=" over";
}
node2.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList2;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top