i have made a menu based on "Modern Bricks Menu" from the dd css library
the problem is i can't get the javascript part of what i want to work.
assume we have this html:
i want to do the folowing:HTML Code:<div id="menu"> <div id="rootmenu"> <ul> <li id="home"><a href="#">home</a></li> <li id="test"><a href="#">test</a></li> </ul> </div> <div class="submenu"> <div class="sub" id="home-sub"> <a href="#">1</a> | <a href="#">2</a> | <a href="#">3</a> | </div> <div class="sub" id="test-sub"> <a href="#">1</a> | <a href="#">2</a> | <a href="#">3</a> | </div> </div> </div>
on mousover-ing a <li>(or the link inside it)
-the bar under the menu must
change in the bar representing the submenu of that item
(when i mouseover "home" "home-sub" changes from "hidden" to "block")
-the color of the <li> must change in the color for that item
-the color of the previsously selected <li> must return to black
-the previsously open sub-div must be returned to "hidden"
now i heve the following code (some parts are dutch):
where the klap_ are the ids of the "underbar"Code:function uitklappen(welke, color) { document.getElementById("home").style.background = "black"; document.getElementById("videoportal").style.background = "black"; document.getElementById("gallery").style.background = "black"; document.getElementById("members").style.background = "black"; document.getElementById("klap_home").style.display = "none"; document.getElementById("klap_videoportal").style.display = "none"; document.getElementById("klap_gallery").style.display = "none"; document.getElementById("klap_members").style.display = "none"; var deze = document.getElementById("klap_"+welke); var rootmen = document.getElementById(welke); welke.style.background = color; }
it works but the problem is that every time the function is called it must first reset all the elements background or display.
so my (simple) question is,
is there a simple way to scan all the li/div -s and change their states inside the menu div?
or must i try a different approch?
Jurgen




Reply With Quote

Bookmarks