I’m trying to cut down on the page space one of my link menus takes up, so I tried to write a code that would only display the itemized links if I click on the main one. I keep getting script errors, and would appreciate any help.
My test style:
[code=php]
#test {visibility: hidden; display: none;}
My attempt at Javascript (just the open function to make it easier to read):
[code=php]
function openMenu(lookit) {
if((document.getElementById)&&(document.getElementById(lookit).style.visibility = “hidden”)) {
document.getElementById(lookit).style.visibility = “visible”;
document.getElementById(lookit).style.display = “block”;
}
elseif((document.all)&&(document.all[lookit].style.visibility = “hidden”)) {
document.all[lookit].style.visibility = “visible”;
document.all[lookit].style.display = “block”;
} }
And lastly, the call to the function itself:
[code=php]
<li><a href=”javascript:openMenu(‘test’);”>Test</a></li>
<div id=”test”><ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul></div>