bigpapaguru
Instructor
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;
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;