javascript - click opens menu, click again closes

Associate
Joined
26 Jun 2003
Posts
1,140
Location
North West
At the moment, when u click the menu item, it expands, displaying a div. Clicking again, closes it. As expected. But when I click a link inside the opened div, it closes again.

Heres my code (its actually my mates code that im trying to ejust)

Im not actually sure what the maxwell is and why its needed. There must be a better version around.

Basically like the "Posting Rules" at the bottom of these forums.

Code:
<script language="javascript">
<!--
var state = 'none';

function showhide(layer_ref)
{
	if (state == 'inline')
		state = 'none';	
	else
		state = 'inline';

	if (document.all)
		eval( "document.all." + layer_ref + ".style.display = state");

	if (document.layers)
		document.layers[layer_ref].display = state;

	if (document.getElementById && !document.all)
	{
		maxwell_smart = document.getElementById(layer_ref);
		maxwell_smart.style.display = state;
	}	
}
//-->
</script>

...
<h1><a href="javascript:showhide(\'WebsiteSettings\');">Website Settings</a></h1>
<div id="WebsiteSettings" style="display:none">
<dl>
<dt>Settings</dt>
<dd><a href="?p=sitesettings">Site Settings</a></dd>
</dl>
</div>
...

Thx
 
Last edited:
Not a new window, the little arrow that opens/closes the box. Im lookin at the code but cant get it to work.
 
yeh im trying to set a cookie now but cant get it to work.

After browsing the source for this forum I can find anywhere where the cookie is being loaded and setting the collapse anywhere. :confused:
 
Back
Top Bottom