Ok, so from reading the javascript phase book i wrote this small function to expand/collapse div for menus:
[CODE]
function ExpandCollapseById(div_id)
{
var element = document.getElementById(div_id);
if(element.style.display != “block”)
{
element.style.display = “block”;
}
else
{
element.style.display = “none”;
}
return false;
}
now if a menu is set tpo be collapsed by default( ex display: none; ) the function works fine but if the menu is expanded by default(ex display: block; ) I have to click on the link 2 times to get is to work. does anyone know what could cause this, is there anything wrong with my code.
the html code is:
<a class=”white_link” href=”javascript:void(0);” onclick=”ExpandCollapseById(‘links’);”>