window.onload=function(){ menuItems=document.getElementById("menu").getElementsByTagName("li"); for(itemIndex in menuItems){ menuItem=menuItems[itemIndex]; menuItem.onmouseover=menuOver; menuItem.onmouseout=menuOut; menuItem.onclick=menuClick; } }; function menuClick(){ window.location=this.getElementsByTagName("a")[0].href; } function menuOver(){ this.oldClass=this.className; this.className="over"; } function menuOut(){ this.className=this.oldClass; this.oldClass=null; }