Link to home
Start Free TrialLog in
Avatar of vccaps
vccaps

asked on

Sub sections in menu won't close when different subsection is clicked.

I have a menu that will not close a subsection as a new subsection opens. I need to have it so that only one section is opened at a time. All of the code I have so far is attached. Thanks!
<html>
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Calgary Health Region - PCIS</title>
<link rel="stylesheet" type="text/css" href="chr_iweb_style.css">
 
 
<!-- This script detects if the user is using Netscape 4.x and redirects them if they are -->
<style>
#clicknav {
font-size: 80%;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
 
#clicknav, #clicknav ul, #clicknav li {
margin: 0;
padding: 0;
list-style: none;
}
 
 
#clicknav a {
display: block;
height: 1.2em;
padding: 0.25em;
text-decoration: none;
}
 
 
/* IE style \*/ 
* html #clicknav a.span  
{ 
margin: 0px 0px -3px 0px;
padding: 3px 3px 3px 3px;
display: block;
position: relative;
 
} 
/* IE style */ 
 
 
#clicknav a.span {
color: #fff;
background-color: #336699;
margin: 0px 0px 0px 0px;
padding: 3px 3px 3px 3px;
display: block;
position: relative;
}
 
#clicknav a.span:hover {
color: #fff;
background-color: #993300;
}
 
#clicknav a.span img {
position: absolute;
top: 3px;
right: 3px;
border: 0;
}
 
#clicknav li {
border: thin solid white;
clear: both;
}
 
#clicknav li ul li {
border: none;
}
 
#clicknav li ul li a {
color: #666;
border-top: solid 1px #fff;
background-color: #D1DBE5;
}
 
#clicknav li ul li a:hover {
color: black;
background-color: #b2cce5;
}
ul{
list-style-type: square;
}
 
ul ul{
list-style-type: disc;
}
 
ul ul ul{
list-style-type: none;
}
 
ul#navlist li a,ul#subnavlist li a{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
text-decoration: none;
}
 
div#navcontainer
{
width: 206px;
background: #fff;
padding: 0px;
}
 
ul#navlist
{
list-style-type: none;
margin: 0;
padding: 0;
}
 
ul#navlist li { display: inline; }
 
ul#navlist li a{
color: #fff;
display: block;
background: #336699;
padding: 3px 0 3px 5px;
border-top: solid 1px #fff;
width: 196px;
}
 
 
/* IE style \*/ 
* html #navlist li a  
{ 
color: #fff;
display: block;
background: #336699;
margin: 0 0 0 0px;
padding: 3px 0 3px 5px;
border-top: solid 1px #fff;
width: 206px; 
} 
/* IE style */ 
 
 
 
ul#navlist li a:hover { background: #993300; }
 
ul#navlist li a#current{
color: #fff;
font-weight: normal;
background: #334465;
}
 
ul#navlist li a#quick{
color: #fff;
font-weight: normal;
background: #19334C;
}
 
 
/************** SUB NAV LIST **************/
 
ul#subnavlist{
margin: 0 0 0 0px;
list-style-type: none;
padding: 0;
}
 
ul#subnavlist li { display: inline; }
 
ul#subnavlist li a
{
display: block;
color: #666;
background: #B2CCE5;
padding: 3px 0 3px 10px;
border-top: solid 1px #fff;
height: auto;
width: 190px;
}
 
 
/* IE style \*/ 
* html #subnavlist li a  
{
display: block;
color: #666;
background: #D1DBE5;
padding: 3px 0 3px 10px;
border-top: solid 1px #fff;
height: auto;
width: 205px;
} 
/* IE style */ 
 
 
 
ul#subnavlist li a:hover { background: #b2cce5; }
 
ul#navlist li a#subcurrent{
color: #333;
background: #ddddb0;
}
 
ul#navlist li a:hover#subcurrent { background: #d1cd98; }
 
 
 
 
</style>
 
<script type="text/javascript">
 
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";
			document.getElementById('p' + obj).src= "http://iweb.calgaryhealthregion.ca/images/minus1.png";
		
			
		}else{
			el.style.display = "none";
			document.getElementById('p' + obj).src= "http://iweb.calgaryhealthregion.ca/images/plus1.png";
	
			}
	}
}
 
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
 
 
 
 
</script>
</head>
 
<body>
 
<!-- Keep all menus within masterdiv-->
<table border="0" width="209" cellspacing="0" cellpadding="0">
<tr><td width="27%" valign="top">	
<div id="masterdiv">
	<ul id="clicknav"><li><a href="http://iweb.calgaryhealthregion.ca/pcis/" class="span" onclick="SwitchMenu('sub1')">PCIS Home<img border="0" src="http://iweb.calgaryhealthregion.ca/images/home-icon.png" width="18" height="18"></a>
	<ul class="submenu" id="sub1">
		<li><a href="../../pcis/pcishome/about.htm">About PCIS</a></li>
		<li><a href="../../pcis/pcishome/activationinfo/index.htm">Activation Information</a></li>
		<li><a href="../../pcis/pcishome/contact.htm">Contact Us</a></li>
		<li><a href="../../pcis/pcishome/devices.htm">Devices</a></li>
		<li><a href="../../pcis/pcishome/news/index.htm">News</a></li>
		<li><a href="../../pcis/pcishome/outages.htm">Outages</a></li>
		<li><a href="../../pcis/pcishome/policies_procedures.htm">Policies and Procedures</a></li>
	</span></ul></li>
 
<li><a href="#" class="span" onclick="SwitchMenu('sub2')">Clinical Programs<img id="psub2" src="http://iweb.calgaryhealthregion.ca/images/plus1.png" alt="" style="position: absolute; right: 3; top: 3; width: 19px; height: 19px" width="19" height="19"></a></a>
	<ul class="submenu" id="sub2">
		<li><a href="index_memostestb.htm">Clinical Programs Overview</a></li>
		<li><a href="../../pcis/Clinical_Programs/cardiacsciences/index.htm">Cardiac Sciences</a></li>
		<li><a href="../../pcis/Clinical_Programs/criticalcare/index.htm">Critical Care/ED/Neuro Sciences</a></li>
		<li><a href="../../pcis/Clinical_Programs/medicine/medicine.htm">Medicine</a></li>
		<li><a href="../../pcis/Clinical_Programs/mentalhealth/index.htm">Mental Health</a></li>
		<li><a href="../../pcis/Clinical_Programs/surgery/index.htm">Surgery/Anesthesia
</a></li>
		<li><a href="../../pcis/Clinical_Programs/womenshealth/index.htm">Women's Health/Neonatal</a></li>
	</span></ul></li>
 
	<li><a href="index_memostestd.htm" class="span">Nursing/Allied Health Corner</a></li>
		<li><a href="#" class="span" onclick="SwitchMenu('sub3')">Physician's Corner<img id="psub3" src="http://iweb.calgaryhealthregion.ca/images/plus1.png" alt="" style="position: absolute; right: 3; top: 3; width: 19px; height: 19px" width="19" height="19"></a>
	<ul class="submenu" id="sub3">
		<li><a href="../../pcis/physician/news.htm">News</a></li>
		<li><a href="../../pcis/physician/mdremoteaccess.htm">Remote Access (FOB)</a></li>
		<li><a href="../../pcis/physician/learningresources.htm">Learning Resources</a></li>
	</span></ul></li>
	
	<li><a href="#" class="span" onclick="SwitchMenu('sub4')">Sunrise Clinical Manager<img id="psub4" src="http://iweb.calgaryhealthregion.ca/images/plus1.png" alt="" style="position: absolute; right: 3; top: 3; width: 19px; height: 19px" width="19" height="19"></a>
	<ul class="submenu" id="sub4">
		<li><a href="../../pcis/scm/index.htm">SCM Overview</a></li>
		<li><a href="../../pcis/scm/scm_accessandtraining.htm">Access & Training</a></li>
		<li><a href="../../pcis/scm/howto/howtos.htm">How To's</a></li>
		<li><a href="../../pcis/scm/ordersets/index.htm">Order Sets</a></li>
	</li>
	<li><a href="../../pcis/scm/resources.htm">Resources</a></li>
	</li>
	<li><a href="../../pcis/scm/alliedhealth/index.htm">Allied Health</a></li>
	</li>
	<li><a href="../../pcis/scm/ambulatory/index.htm">Ambulatory</a></li>
	</li>
	<li><a href="../../pcis/scm/inptworkflow.htm">Inpatient Workflows </a></li>
	</span></ul></li>
	
	<li><a href="#" class="span" onclick="SwitchMenu('sub5')">Clinibase (PIEM)<img id="psub5" src="http://iweb.calgaryhealthregion.ca/images/plus1.png" alt="" style="position: absolute; right: 3; top: 3; width: 19px; height: 19px" width="19" height="19"></a>
	<ul class="submenu" id="sub5">
		<li><a href="../../pcis/clinibase/index.htm">Clinibase Overview</a></li>
		<li><a href="../../pcis/clinibase/cb_accessandtraining.htm">Access & Training (FMC/PLC/RGH)
</a></li>
		<li><a href="../../pcis/clinibase/cb_scheduler.htm">Clinibase/Scheduler (ACH/SCHC)</a></li>
		<li><a href="../../pcis/clinibase/resources.htm">Resources</a></li>
	</li>
	<li><a href="../../pcis/clinibase/piem.htm">PIEM</a></li>
	</li>
	<li><a href="../../pcis/clinibase/cbworkflows.htm">Clinibase Workflows</a></li>
	</li>
	<li><a href="../../pcis/clinibase/admitting.htm">Admitting</a></li>
	</li>
	<li><a href="../../pcis/clinibase/inpatients.htm">Inpatients </a></li>
	</li>
	<li><a href="../../pcis/clinibase/outpatients.htm">Outpatients</a></li>
	</span></ul></li>
 
		<li><a href="#" class="span" onclick="SwitchMenu('sub6')">Other Applications<img id="psub6" src="http://iweb.calgaryhealthregion.ca/images/plus1.png" alt="" style="position: absolute; right: 3; top: 3; width: 19px; height: 19px" width="19" height="19"></a>
	<ul class="submenu" id="sub6">
		<li><a href="../../pcis/otherapps/ormanager.htm">OR Manager</a></li>
		<li><a href="../../pcis/otherapps/qs.htm">QS</a></li>
		<li><a href="../../em/redis.htm">REDIS</a></li>	</span></ul></li>
		<li><a class="span" href="../../pcis/forms/index.htm">Forms</a></li>
		
			<li><a class="span" href="../../pcis/comments/index.htm">Feedback and Submissions</a></li>	
	
	
	<li><a class="span" href="#"><!-- This is your search box -->
Search<br>
<input type="radio" name="site" value="PCIS" selected=true checked><font style="font-size: 8pt">PCIS</font><br><font style="font-size: 3pt">
<input type="radio" name="site" value="Iweb"></font><font style="font-size: 8pt">iWeb </font>
<font style="font-size: 7.5pt">(internal CHR pages)</font><font style="font-size: 3pt">
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="q" size="21">
 
<!-- Your search button -->
<input type="submit" class="button" value="Go" name="B1"><br><a class="span" href="http://iwebsearch.calgaryhealthregion.ca/search?entqr=0&access=p&ud=1&sort=date%3AD%3AL%3Ad1&output=xml_no_dtd&site=PCIS&ie=UTF-8&oe=UTF-8&client=default_frontend&proxystylesheet=default_frontend&proxycustom=%3CADVANCED/%3E"><font size="1">Advanced Search</font></a>
<br></a></li>
 
<input type="hidden" name="entqr" value="0">
<input type="hidden" name="ud" value="1">
<input type="hidden" name="sort" value="date:D:L:d1">
<input type="hidden" name="output" value="xml_no_dtd">
<input type="hidden" name="oe" value="UTF-8">
<input type="hidden" name="ie" value="UTF-8">
<input type="hidden" name="client" value="default_frontend">
<input type="hidden" name="proxystylesheet" value="default_frontend">
</form>
 
</ul></ul></div></td>	
	
    </tr>
    
    </table>
 
</body>
 
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vccaps
vccaps

ASKER

Thank you so much! I have been out of the html world since 2003 and these little things take so much time trying to figure out. I tried it and it worked. Thanks again! Adam