I love the wonderful Switch Menu you have provided! I am new at this and am having one issue that I have tried to fix by utilizing these forums. However it doesn't seem to be working for me.
Each subject on our website has a separate template with its own unique switch menu.
I would like for the particular sub menu that was selected to remain open when going to the linked page. I have tried adding the cookies code and made sure that the "persistemenu" is correct. But still no luck. The code for one of the templates is below, and the site is http://www.jazzschool.com/html/test/institute.html
Any help would be appreciated!
HTML Code:</style> <style type="text/css"> .menutitle{ cursor:pointer; margin-bottom: 5px; color:#000000; width:140px; padding:2px; text-align:left; font-weight:bold; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-transform: capitalize; } .submenu{ margin-bottom: 0.5em; font-family: Arial, Helvetica, sans-serif; text-transform: capitalize; color: #000000; text-indent: 10px; } </style> <script type="text/javascript"> /*********************************************** * Switch Menu script- by Martial B of http://getElementById.com/ * Modified by Dynamic Drive for format & NS4/IE4 compatibility * Visit http://www.dynamicdrive.com/ for full source code ***********************************************/ var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc) var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only if (document.getElementById){ //DynamicDrive.com change document.write('<style type="text/css">\n') document.write('.submenu{display: none;}\n') document.write('</style>\n') } function SwitchMenu(obj){ if(document.getElementById){ var el = document.getElementById(obj); var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change if(el.style.display != "block"){ //DynamicDrive.com change for (var i=0; i<ar.length; i++){ if (ar[i].className=="submenu") //DynamicDrive.com change ar[i].style.display = "none"; } el.style.display = "block"; }else{ el.style.display = "none"; } } } function get_cookie(Name) { var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) if (offset != -1) { offset += search.length end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(offset, end)) } } return returnvalue; } function onloadfunction(){ if (persistmenu=="yes"){ var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname var cookievalue=get_cookie(cookiename) if (cookievalue!="") document.getElementById(cookievalue).style.display="block" } } function savemenustate(){ var inc=1, blockid="" while (document.getElementById("sub"+inc)){ if (document.getElementById("sub"+inc).style.display=="block"){ blockid="sub"+inc break } inc++ } var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid document.cookie=cookiename+"="+cookievalue } if (window.addEventListener) window.addEventListener("load", onloadfunction, false) else if (window.attachEvent) window.attachEvent("onload", onloadfunction) else if (document.getElementById) window.onload=onloadfunction if (persistmenu=="yes" && document.getElementById) window.onunload=savemenustate function get_cookie(Name) { var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) if (offset != -1) { offset += search.length end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(offset, end)) } } return returnvalue; } function onloadfunction(){ if (persistmenu=="yes"){ var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname var cookievalue=get_cookie(cookiename) if (cookievalue!="") if (cookievalue!="[]"){ openids=new Array() openids=eval(cookievalue) for (i = 0; i < openids.length; i++){ if (openids[i]!==undefined) document.getElementById(openids[i]).style.display="block" } } } } function savemenustate(){ var inc=1, blockid="[" while (document.getElementById("sub"+inc)){ if (document.getElementById("sub"+inc).style.display=="block")//{ blockid+="'sub"+inc+"'," //break //} inc++ } blockid+="]" var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid document.cookie=cookiename+"="+cookievalue } if (window.addEventListener) window.addEventListener("load", onloadfunction, false) else if (window.attachEvent) window.attachEvent("onload", onloadfunction) else if (document.getElementById) window.onload=onloadfunction if (persistmenu=="yes" && document.getElementById) window.onunload=savemenustate </script> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta http-equiv="Expires" content="Mon, 11 Dec 2007 08:20:20 GMT" /> <!-- TemplateBeginEditable name="doctitle" --> <title>The Jazzschool for Music Study and Performance</title> <!-- TemplateEndEditable --> <style type="text/css"> <!-- .text1 { font-size:12px; font-family:Arial, Helvetica, sans-serif; color:#CCCCCC; font-style: normal; font-weight: normal; } --> </style> </style> <td height="76"><p class="SUBJECT">jazzschool institute</p> <div class="menutitle" onclick="SwitchMenu('sub1')"><a href="../html/test/institute_about.html" class="changecolour">about</a><br /> </div> <div class="menutitle" onclick="SwitchMenu('sub2')"><a href="../html/test/institute_mission.html" class="changecolour">mission & vision</a></div> <div class="menutitle" onclick="SwitchMenu('sub3')"><a href="../html/test/institute_calendar.html" class="changecolour">jazzschool institute academic calendar</a></div> <div class="menutitle" onclick="SwitchMenu('sub4')"><a class="changecolour">program</a></div> <span class="submenu" id="sub4"> <br /> <a href="../html/test/institute_goals.html">program goals</a><br /> <a href="../html/test/institute_bachelor.html">bachelor of music degree</a><br /> <a href="../html/test/institute_curriculum.html">instrumental & vocal curriculum</a><br /> <a href="../html/test/institute_admission.html">application & admission</a><br /> </span> <div class="menutitle" onclick="SwitchMenu('sub5')"><a class="changecolour">courses</a></div> <span class="submenu" id="sub5"> <br /> <a href="../html/test/institute_musicianship.html">musicianship</a><br /> <a href="../html/test/institute_theory.html">theory</a><br /> <a href="../html/test/institute_harmony.html">harmony</a><br /> <a href="../html/test/institute_composition.html">composition</a><br /> <a href="../html/test/institute_history.html">history</a><br /> <a href="../html/test/institute_private.html">private instruction</a><br /> <a href="../html/test/institute_instrumentalensemble.html">instrumental performance ensemble</a><br /> <a href="../html/test/institute_vocalperfomance.html">vocal performance</a><br /> <a href="../html/test/institute_technology.html">music technology</a><br /> <a href="../html/test/institute_bom.html">business of music</a><br /> <a href="../html/test/institute_performancetech.html">performance technique</a><br /> <a href="../html/test/institute_senior.html">senior project</a><br /> </span> <div class="menutitle" onclick="SwitchMenu('sub6')"><a class="changecolour">class templates</a></div> <span class="submenu" id="sub6"> <br /> <a href="../html/test/institute_instrumentaltemplate.html">instrumentalists</a><br /> <a href="../html/test/institute_vocaltemplate.html">vocalists</a></span><span class="submenu"><br /> </span> <div class="menutitle" onclick="SwitchMenu('sub7')"><a href="../html/test/institute_faculty.html" class="changecolour">faculty</a></div> <div class="menutitle" onclick="SwitchMenu('sub8')"><a href="../html/test/institute_satffboard.html" class="changecolour">staff & board</a></div> <div class="menutitle" onclick="SwitchMenu('sub9)"><a href="../html/test/institute_map.html" class="changecolour">map & directions</a></div> <div class="menutitle" onclick="SwitchMenu('sub10')"><a href="../html/test/institute_contact.html" class="changecolour">contact</a></div> <div id="masterdiv">



Reply With Quote
Bookmarks