View Full Version : javascript and css menu...

08-30-2006, 08:01 AM
I had to copy a little bit of javascript to make my CSS work in IE. The css calls on a unsorted list to make a menu. In order to work in IE I had to name the top level <ul> to <ul id='nav'> and run the following script. This works fine for the first menu on the page, but none of the others work. There are an unlimited # of menus since each product listed on this page has a menu next to it that pops up the features for that product. Everything is databased fed.

Is there any other javascript which will work on all the menus? Otherwise I'll have to write a php program to output the javascript based on whatever products are showing...


<script language="javascript">

startList1 = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
node.onmouseout=function() {
this.className=this.className.replace(" over","");

Philip M
08-30-2006, 08:23 AM
You appear to have multiple window.onload statements so each one overwrites the previous one.

For an explanation and the solution see:-