F
fj
I have no problem nevigate and neil down the element I want to manipulate.
What I want to do is set the css class of an item according to
window.location (URL). But it doesn't work.
I call this function in
<body onload="SelectMenuItem();" >
here is the function
function SelectMenuItem() {
....
//i is a variable I set before.
var nodes_LI = document.getElementById("TopNav").childNodes;
for (j=0; j<nodes_LI.length; j++) {
nodes_LI[j].firstChild.removeAttribute("class");
}
nodes_LI.firstChild.setAttribute("class", "highlighted");
....
}
What I want to do is set the css class of an item according to
window.location (URL). But it doesn't work.
I call this function in
<body onload="SelectMenuItem();" >
here is the function
function SelectMenuItem() {
....
//i is a variable I set before.
var nodes_LI = document.getElementById("TopNav").childNodes;
for (j=0; j<nodes_LI.length; j++) {
nodes_LI[j].firstChild.removeAttribute("class");
}
nodes_LI.firstChild.setAttribute("class", "highlighted");
....
}