View Full Version : Collapsible Menus - Remeber State

11-05-2006, 02:25 AM
I've searched the internet everywhere and can't find anything so any help would be much appreciated.

Okay below is the JavaScript I am using to have my menus be collapsible. Below that is the HTML of each menu. What would you recommend doing in saving the collapse state, prob by a cookie, based on what they chose for the id of the div.

So, for example, below (in the HTML) I have <div id="MenuA"> how would I make a cookie that will save the collapse state for MenuA..then for the next menu, MenuB and so on..

Thanks very much for any help!!

<script language="JavaScript" type="text/javascript">
function flexToggle(el) {
if (el.className == 'flex_open') {
el.className = 'flex_shut';
} else {
el.className = 'flex_open';

<div id="MenuA" class="flex_shut">
<div class="when_shut">
<div class="flex_header clearfix" title="Click to Expand" onclick="flexToggle(this.parentNode.parentNode)">

<h8>About Me</h8>

<div class="when_open">
<div class="flex_header clearfix" title="Click to Collapse" onclick="flexToggle(this.parentNode.parentNode)">
<div><h9>About Me</h9></div></div><div id="fieldreg" class="infocolor">
<?php print $user->profile_aboutme ?></div>