View Full Version : HOw to create a row of expanding menus?

09-21-2005, 10:06 PM
I'm having trouble getting each column of expanding menus in the row to expand. It seems that the first column works find but the others do not. I through up an example at:


I'm a little perplexed.

is there just a little bit of code to change or should i slap in copies of the java code in the <head> area with menu2, menu3, and menu4. But if I do that it doesn't work. Is there a way possibly to put all the actions into one event handler?

Thanks to anyone who responds.

Spunky844 out... :thumbsup:

09-21-2005, 10:32 PM
From what I'm seeing, I think your best bet would be to loop through the ul tags rather than just grabbing it by the id 'menu'.

But I didn't spend too much time really looking at everything...

09-22-2005, 04:29 AM
What would the looping code look like?


end loop

it's been a while since I took that java class.

09-22-2005, 12:50 PM
Something like...

var iList = document.getElementsByTagName("ul");
for (u = 0; u < iList.length; u ++) {

menus = iList.item(u);

So rather than calling document.getElementById("menu"), you would call iList.item(u) or iList[u]. Whichever you prefer.

But remember, you would have to have any code using the document.getElementById("menu") to be inside of the loop.

Hope this helps.