View Full Version : Javascript Expanding Menu

07-13-2010, 09:04 PM
function initMenu(){
var menus, menu, text, a, i, CurrentID;
menus = getChildrenByElement(document.getElementById("menu"));
CurrentID = document.getElementById("auto");
for(i = 0; i < menus.length; i++){
menu = menus[i];
text = getFirstChildByText(menu);
a = document.createElement("a");
menu.replaceChild(a, text);
a.href = "#";
a.onclick = showMenu;
a.onfocus = function(){this.blur()};


//CurrentID.showMenu; thought this would work but it doesn.t

I am modifying a website for a company I am interning at. I have no javascript experience and was just thrown in. I need the menu to open when page is clicked so that it looks like the menu stayed open when you made a selection and the new page loads. I have a id in the html of the pages called "auto" to designate the menu item in the page to be opened. If anyone could help I would be very grateful. I will be keeping a lookout for posts