View Full Version : Smart Folding Menu Tree Script Cookie

06-10-2005, 06:07 PM
Is it possible to change the cookie for this menu system to remember what menu is open on the previous page, and have those menu items be open on the page you just navigated to? currently it remembers the state of the menu on the page you left, and then when you leave that page and go to a new one it will set a new cookie for that page. if you then go back to the original page the menu items are open how you left them.

i want the menu to be global and remember the state of the menu from page to page. does that make sense?

Here is the cookie code:

<script language="JavaScript1.2">

function get_cookie(Name) {
//Get cookie routine by Shelley Powers
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
// if cookie exists
if (offset != -1) {
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
return returnvalue;

var foldercontentarray=new Array()
var c=0

if (ns6){
for (i=0;i<document.getElementsByTagName("UL").length;i++){
if (document.getElementsByTagName("UL")[i].id=="foldinglist"){

if (get_cookie(window.location.pathname) != ''){
var openresults=get_cookie(window.location.pathname).split(" ")
for (i=0 ; i < openresults.length ; i++){
if (ns6){
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImage="url(open.gif)"

if (ns6||ie4){
var nodelength=ns6? c-1 : foldinglist.length-1
var nodes=new Array(nodelength)
var openones=''

function checkit(){
for (i=0 ; i <= nodelength ; i++){
if ((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style.display==''))
openones=openones + " " + i

if (ns6||ie4)

06-13-2005, 06:55 PM

06-15-2005, 06:18 PM
second bump- i really need help on this one.

06-15-2005, 06:53 PM
It can be done, make it more like the persistence feature of:


with the 'sitewide' option.

If you need help coding, I'll get to it as soon as I can but, if you have some knowledge of javascript, you should be able to make the changes yourself.

05-19-2006, 08:30 PM
I made every effort I was capable of to accomplish what you did with the latter mentioned menu script, but was unable to achieve persistence across pages for this script.

I would suggest that if you had the time, it would greatly increase the value of this script to have persistence across all pages as an option.

Thank you for the consideration.