PDA

View Full Version : Switch Menu Additions



kdm2918
03-22-2005, 06:04 PM
Script: DD Switch Menu
http://www.dynamicdrive.com/dynamicindex1/switchmenu.htm

Hi
I hope this is a an easy question. What I would like to know is there any way to add to the Switch Menu code so it can have more than one level of sub menus. Using the menu as is show at the link above I would like to have a second menu that drops down from the "What's New" text that is below the "Site Menu" pick.

Thanks for any help. KDM2918

jscheuer1
03-24-2005, 04:14 AM
Not too easy for me but, this way I learn something too ;). Still haven't figured out how to extend the persistence to these added levels.

OK, here we go, add to the style section (this is where you can change the look of these new elements):


.submenutitle {

cursor:pointer;
margin-top:4px;
margin-bottom: 2px;
background-color:#ECECFF;
color:#000000;
width:110px;
padding:2px;
text-align:center;
font-weight:bold;
font-size:smaller;
/*/*/border:1px solid #000000;/* */
}

.ssubmenu{
margin-bottom: 0.5em;
}

Just below the line that says:

document.write('.submenu{display: none;}\n')add this line:

document.write('.ssubmenu{display: none;}\n')

Just below the SwitchMenu function (just above the line that says "function get_cookie(Name) {") add this function:

function SwitchsubMenu(obj){
if(document.getElementById){
var sel = document.getElementById(obj);
var sar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(sel.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<sar.length; i++){
if (sar[i].className=="ssubmenu") //DynamicDrive.com change
sar[i].style.display = "none";
}
sel.style.display = "block";
}else{
sel.style.display = "none";
}
}
}Now in the markup (HTML section), here is how things will look, I added two inner switch menus so you get the idea, one where you said you wanted it and one at the end of the existing 'Site Menu' listings. Following this format, you can add as many of these as you like. Example HTML:


<!-- Keep all menus within masterdiv-->
<div id="masterdiv">

<div class="menutitle" onclick="SwitchMenu('sub1')">Site Menu</div>
<span class="submenu" id="sub1">
<div class=submenutitle onclick="SwitchsubMenu('ssub1')">What's New</div>
<span class=ssubmenu id=ssub1>
- <a href="http://www.statestreetblues.com/">State Street Blues Stroll!</a><br>
- <a href="http://www.mediajazzbynight.com/">Media Jazz by Night!</a>
</span>
- <a href="../hot.htm">What's hot</a><br>
- <a href="../revised.htm">Revised Scripts</a><br>
- <a href="../morezone/">More Zone</a>
<div class=submenutitle onclick="SwitchsubMenu('ssub2')">Yet More Choices</div>
<span class=ssubmenu id=ssub2>
- <a href="http://www.yahoo.com/">Yahoo!</a>
</span>
</span>

<div class="menutitle" onclick="SwitchMenu('sub2')">FAQ/Help</div>
<span class="submenu" id="sub2">
- <a href="../notice.htm">Usage Terms</a><br>
- <a href="../faqs.htm">DHTML FAQs</a><br>
- <a href="../help.htm">Scripts FAQs</a>
</span>

<div class="menutitle" onclick="SwitchMenu('sub3')">Help Forum</div>
<span class="submenu" id="sub3">
- <a href="http://www.codingforums.com">Coding Forums</a><br>
</span>

<div class="menutitle" onclick="SwitchMenu('sub4')">Cool Links</div>
<span class="submenu" id="sub4">
- <a href="http://www.javascriptkit.com">JavaScript Kit</a><br>
- <a href="http://www.freewarejava.com">Freewarejava</a><br>
- <a href="http://www.cooltext.com">Cool Text</a><br>
- <a href="http://www.google.com">Google.com</a>
</span>

<img src="files/about_off.gif" onclick="SwitchMenu('sub5')"><br>
<span class="submenu" id="sub5">
- <a href="http://www.dynamicdrive.com/link.htm">Link to DD</a><br>
- <a href="http://www.dynamicdrive.com/recommendit/">Recommend Us</a><br>
- <a href="http://www.dynamicdrive.com/contact.htm">Email Us</a><br>
</span>

</div>Perhaps someone else who is more familiar with cookies than I will jump in here and help us expand the persistence part of this script to include these new ssub menus.

jscheuer1
03-24-2005, 05:49 AM
Finally figured the persistence thing, if you want your new sub, sub menus to have persistence substitute these two functions for the ones of the same names in the code:


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"
}
if (persistmenu=="yes"){
var scookiename=(persisttype=="sitewide")? "sswitchmenu" : "s"+window.location.pathname
var scookievalue=get_cookie(scookiename)
if (scookievalue!="")
document.getElementById(scookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
var sinc=1, sblockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
while (document.getElementById("ssub"+sinc)){
if (document.getElementById("ssub"+sinc).style.display=="block"){
sblockid="ssub"+sinc
break
}
sinc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
var scookiename=(persisttype=="sitewide")? "sswitchmenu" : "s"+window.location.pathname
var scookievalue=(persisttype=="sitewide")? sblockid+";path=/" : sblockid
document.cookie=scookiename+"="+scookievalue
}

kdm2918
03-24-2005, 11:21 PM
Hi jscheuer1:

Thank you, the code you provided works great. It does just what I needed it to do. You have been a life saver.

Thanks Again
KDM2918

miradoro
04-19-2005, 05:15 PM
my name is ivan and i was wondering if you could help me solve a problem.

i am using the Script: DD Switch Menu
http://www.dynamicdrive.com/dynamic.../switchmenu.htm


What I would like to know is there any way to add to the Switch Menu code so it can have as many sub menus as i need.

i found this page http://www.dynamicdrive.com/forums/showthread.php?t=2166

but i dont know how to add more submenus

Please advise,

Thank you very much

jscheuer1
04-19-2005, 05:38 PM
Here is the entire code for a new demo with comments in the HTML section to show how the nested sub menus are added:


<html>
<head>
<style type="text/css">
.menutitle{
cursor:pointer;
margin-bottom: 5px;
background-color:#ECECFF;
color:#000000;
width:140px;
padding:2px;
text-align:center;
font-weight:bold;
/*/*/border:1px solid #000000;/* */
}

.submenu{
margin-bottom: 0.5em;
}

.submenutitle {

cursor:pointer;
margin-top:4px;
margin-bottom: 2px;
background-color:#ECECFF;
color:#000000;
width:110px;
padding:2px;
text-align:center;
font-weight:bold;
font-size:smaller;
/*/*/border:1px solid #000000;/* */
}

.ssubmenu{
margin-bottom: 0.5em;
}
</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
* Modified by John Davenport Scheuer for nested sub menus
***********************************************/

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('.ssubmenu{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 SwitchsubMenu(obj){
if(document.getElementById){
var sel = document.getElementById(obj);
var sar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(sel.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<sar.length; i++){
if (sar[i].className=="ssubmenu") //DynamicDrive.com change
sar[i].style.display = "none";
}
sel.style.display = "block";
}else{
sel.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"
}
if (persistmenu=="yes"){
var scookiename=(persisttype=="sitewide")? "sswitchmenu" : "s"+window.location.pathname
var scookievalue=get_cookie(scookiename)
if (scookievalue!="")
document.getElementById(scookievalue).style.display="block"
}
}


function savemenustate(){
var inc=1, blockid=""
var sinc=1, sblockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
while (document.getElementById("ssub"+sinc)){
if (document.getElementById("ssub"+sinc).style.display=="block"){
sblockid="ssub"+sinc
break
}
sinc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
var scookiename=(persisttype=="sitewide")? "sswitchmenu" : "s"+window.location.pathname
var scookievalue=(persisttype=="sitewide")? sblockid+";path=/" : sblockid
document.cookie=scookiename+"="+scookievalue
}

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-->
<div id="masterdiv">

<div class="menutitle" onclick="SwitchMenu('sub1')">Site Menu</div>
<span class="submenu" id="sub1">
<!-- Begin Sub Sub Menu 1 -->
<div class=submenutitle onclick="SwitchsubMenu('ssub1')">What's New</div>
<span class=ssubmenu id=ssub1>
- <a href="http://www.statestreetblues.com/">State Street Blues Stroll!</a><br>
- <a href="http://www.mediajazzbynight.com/">Media Jazz by Night!</a>
</span><!-- End Sub Sub Menu 1 -->
- <a href="../hot.htm">What's hot</a><br>
- <a href="../revised.htm">Revised Scripts</a><br>
- <a href="../morezone/">More Zone</a>
<!-- Begin Sub Sub Menu 2 -->
<div class=submenutitle onclick="SwitchsubMenu('ssub2')">Yet More Choices</div>
<span class=ssubmenu id=ssub2>
- <a href="http://www.yahoo.com/">Yahoo!</a>
</span><!-- End Sub Sub Menu 2 -->
</span>

<div class="menutitle" onclick="SwitchMenu('sub2')">FAQ/Help</div>
<span class="submenu" id="sub2">
- <a href="../notice.htm">Usage Terms</a><br>
- <a href="../faqs.htm">DHTML FAQs</a><br>
- <a href="../help.htm">Scripts FAQs</a>
</span>

<div class="menutitle" onclick="SwitchMenu('sub3')">Help Forum</div>
<span class="submenu" id="sub3">
- <a href="http://www.codingforums.com">Coding Forums</a><br>
</span>

<div class="menutitle" onclick="SwitchMenu('sub4')">Cool Links</div>
<span class="submenu" id="sub4">
- <a href="http://www.javascriptkit.com">JavaScript Kit</a><br>
- <a href="http://www.freewarejava.com">Freewarejava</a><br>
- <a href="http://www.cooltext.com">Cool Text</a><br>
- <a href="http://www.google.com">Google.com</a>
</span>

<img src="files/about_off.gif" onclick="SwitchMenu('sub5')"><br>
<span class="submenu" id="sub5">
- <a href="http://www.dynamicdrive.com/link.htm">Link to DD</a><br>
- <a href="http://www.dynamicdrive.com/recommendit/">Recommend Us</a><br>
- <a href="http://www.dynamicdrive.com/contact.htm">Email Us</a><br>
</span>

</div>

</body>
</html>

miradoro
04-19-2005, 06:08 PM
Hi,
thanks for the quick response.
Do you think you could you me an example with 4 submenus

Thanks

jscheuer1
04-19-2005, 06:42 PM
OK, put this in place of the current masterdiv:


<!-- Keep all menus within masterdiv-->
<div id="masterdiv">

<div class="menutitle" onclick="SwitchMenu('sub1')">Site Menu</div>
<span class="submenu" id="sub1">
<!-- Begin Sub Sub Menu 1 -->
<div class=submenutitle onclick="SwitchsubMenu('ssub1')">What's New</div>
<span class=ssubmenu id=ssub1>
- <a href="http://www.statestreetblues.com/">State Street Blues Stroll!</a><br>
- <a href="http://www.mediajazzbynight.com/">Media Jazz by Night!</a>
</span><!-- End Sub Sub Menu 1 -->
- <a href="../hot.htm">What's hot</a><br>
- <a href="../revised.htm">Revised Scripts</a><br>
- <a href="../morezone/">More Zone</a>
<!-- Begin Sub Sub Menu 2 -->
<div class=submenutitle onclick="SwitchsubMenu('ssub2')">Yet More Choices</div>
<span class=ssubmenu id=ssub2>
- <a href="http://www.yahoo.com/">Yahoo!</a>
</span><!-- End Sub Sub Menu 2 -->
</span>

<div class="menutitle" onclick="SwitchMenu('sub2')">FAQ/Help</div>
<span class="submenu" id="sub2">
- <a href="../notice.htm">Usage Terms</a><br>
<!-- Begin Sub Sub Menu 4 -->
<div class=submenutitle onclick="SwitchsubMenu('ssub4')">Sub Sub 4</div>
<span class=ssubmenu id=ssub4>
- <a href="http://www.yahoo.com/">Yahoo!</a>
</span><!-- End Sub Sub Menu 4 -->
- <a href="../faqs.htm">DHTML FAQs</a><br>
- <a href="../help.htm">Scripts FAQs</a>
</span>

<div class="menutitle" onclick="SwitchMenu('sub3')">Help Forum</div>
<span class="submenu" id="sub3">
- <a href="http://www.codingforums.com">Coding Forums</a><br>
</span>

<div class="menutitle" onclick="SwitchMenu('sub4')">Cool Links</div>
<span class="submenu" id="sub4">
- <a href="http://www.javascriptkit.com">JavaScript Kit</a><br>
- <a href="http://www.freewarejava.com">Freewarejava</a><br>
- <a href="http://www.cooltext.com">Cool Text</a><br>
- <a href="http://www.google.com">Google.com</a>
<!-- Begin Sub Sub Menu 3 -->
<div class=submenutitle onclick="SwitchsubMenu('ssub3')">Another Sub</div>
<span class=ssubmenu id=ssub3>
- <a href="http://www.statestreetblues.com/">State Street Blues Stroll!</a><br>
- <a href="http://www.mediajazzbynight.com/">Media Jazz by Night!</a>
</span><!-- End Sub Sub Menu 3 -->
</span>

<img src="files/about_off.gif" onclick="SwitchMenu('sub5')"><br>
<span class="submenu" id="sub5">
- <a href="http://www.dynamicdrive.com/link.htm">Link to DD</a><br>
- <a href="http://www.dynamicdrive.com/recommendit/">Recommend Us</a><br>
- <a href="http://www.dynamicdrive.com/contact.htm">Email Us</a><br>
</span>

</div>

miradoro
04-19-2005, 08:33 PM
Hi,

thanks for the support...i think i didnt explain myself right

i wanted to have submenus under the submenus. For instance,

option A
->option Aa
->option Aab
->option Aabc
-x
-y
-z
option B
->option Ba
->option Bab
->option Babc
-x
-y
-z

i hope this clarifies my question
Thanks

jscheuer1
04-19-2005, 09:35 PM
I don't understand that. Looks like it already does that. You can have (menu closed):

item A
item B
item C

say you click on item A, then you see:

item A
- item A1
- item A2
- item A3
item B
item C

Now let's say item A1 has a nested sublevel. If you click on it, you get:

item A
- item A1
-- item A1a
-- item A1b
-- item A1c
- item A2
- item A3
item B
item C

You can add these nested sublevels to any of the level Xn elements and they each can have as many items on them as you want, just no more nesting. If you want more nesting than that, like:

item A
- item A1
-- item A1a
--- item A1a1
--- item A1a2
--- item A1a3
-- item A1b
-- item A1c
- item A2
- item A3
item B
item C

and possibly more, it would be easier to get a menu that supports infinite nesting to begin with.

miradoro
04-20-2005, 01:09 PM
well,

at first i wanted to use another menu but the switch menu is beatiful and i would like to use to its max...

so you think i cant get submenus within a submenu by using this menu script?
Please advise,
Thanks

jscheuer1
04-20-2005, 03:40 PM
It will do what I said it will do. Have you tried the demo(s) I supplied? They, particularly the last demo with the added markup, show the full extent of nesting available. For clarity's sake I will repeat, nesting goes no farther than this:

item A
- item A1
-- item A1a
-- item A1b
-- item A1c
- item A2
- item A3
item B
item C

miradoro
04-20-2005, 05:13 PM
well,

the last code u published didnt work for me...i still get one submenu ...
am i doing something wrong?

last question...

could it go further than 2 submenu?

thanks

jscheuer1
04-20-2005, 06:49 PM
Let me see your work, works here.

miradoro
04-21-2005, 01:04 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Emission Regulations 2005</title>
<style type="text/css">
.menutitle{
cursor:pointer;
margin-left:42px;
margin-bottom: 5px;
/*background-color:#ECECFF;*/
color:#000000;

padding:2px;
text-align:left;
font-weight:bold;
/*border:1px solid #000000;/* */
}

.submenu{
margin-bottom: 0.5em;
margin-left:105px; /*new margin*/
}

.ssubmenu{
margin-bottom: 0.5em;
margin-left:132;
font-size:smaller;
}
.sssubmenu{
margin-bottom: 0.5em;
margin-left:242;
font-size:smaller;
}
/*New code*/
.submenutitle {

cursor:pointer;
margin-top:4px;
margin-bottom: 2px;
margin-left:102;
/*background-color:#ECECFF;*/
color:#000000;

padding:2px;
text-align:left;
font-weight:bold;
font-size:smaller;
/*border:1px solid #000000;/* */
}
.submenubtitle {

cursor:pointer;
margin-top:4px;
margin-bottom: 2px;
margin-left:542;
/*background-color:#ECECFF;*/
color:#000000;
width:110px;
padding:2px;
text-align:left;
font-weight:bold;

/*border:1px solid #000000;/* */
}


a {
font-size: small;
color: #003366;
}
</style>

<script type="text/javascript" src="tree2.js"></script>
</head>

<body>

<!-- Keep all menus within masterdiv-->
<div id="masterdiv">


<div class="menutitle" onclick="SwitchMenu('sub0')">Brazil</div>
<span class="submenu" id="sub0">
- <a href="http://www.cnn.com" target="_blank">option</a><br>
</span>
<div class="menutitle" onclick="SwitchMenu('sub1')">China</div>
<span class="submenu" id="sub1">
<!-- Begin Sub Sub Menu 1 -->
<div class=submenutitle onclick="SwitchsubMenu('ssub1')">Legislation</div>
<span class=ssubmenu id=ssub1>
<!-- </span> End Sub Sub Menu 1 -->
<div class=submenubtitle onclick="SwitchsubMenu('ssub1')">Light Duty</div>
<span class="sssubmenu" id="ssub1">
- <a href="http://www.cnn.com/">option1</a><br>
- <a href="http://www.cnn.com/">option2</a>
</span><!-- End Sub Sub Menu 1 -->
</span>
<!-- Begin Sub Sub Menu 2 -->
<div class=submenutitle onclick="SwitchsubMenu('ssub2')">Driving Cycles</div>
<span class=ssubmenu id=ssub2>

- <a href="http://www.yahoo.com/">Europe</a>
</span><!-- End Sub Sub Menu 2 -->
</span>

<div class="menutitle" onclick="SwitchMenu('sub2')">India</div>
<span class="submenu" id="sub2">
- <a href="../notice.htm">Japan</a><br>
<!-- Begin Sub Sub Menu 4 -->
<div class=submenutitle onclick="SwitchsubMenu('ssub4')">option</div>
<span class=ssubmenu id=ssub4>
- <a href="http://www.yahoo.com/">option</a>
</span><!-- End Sub Sub Menu 4 -->
- <a href="../faqs.htm">option</a><br>
- <a href="../help.htm">option</a>
</span>

<div class="menutitle" onclick="SwitchMenu('sub3')">Japan</div>
<span class="submenu" id="sub3">
- <a href="http://www.codingforums.com">option</a><br>
</span>

<div class="menutitle" onclick="SwitchMenu('sub4')">United States</div>
<span class="submenu" id="sub4">
- <a href="http://www.javascriptkit.com">option</a><br>
- <a href="http://www.freewarejava.com">option</a><br>
- <a href="http://www.cooltext.com">option</a><br>
- <a href="http://www.google.com">option</a>
<!-- Begin Sub Sub Menu 3 -->
<div class=submenutitle onclick="SwitchsubMenu('ssub3')">Another Sub</div>
<span class=ssubmenu id=ssub3>
- <a href="http://www.statestreetblues.com/">option</a><br>
- <a href="http://www.mediajazzbynight.com/">option</a>
</span><!-- End Sub Sub Menu 3 -->
</span>

<div class="menutitle" onclick="SwitchMenu('sub5')">Others</div>
<span class="submenu" id="sub5">
- <a href="http://www.dynamicdrive.com/link.htm">option</a><br>
- <a href="http://www.dynamicdrive.com/recommendit/">option</a><br>
- <a href="http://www.dynamicdrive.com/contact.htm">option</a><br>
</span>

</div>


</body>

</html>


/*tree3.js*/

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){ //change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('.ssubmenu{display: none;}\n')
document.write('.sssubmenu{display: none;}\n\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); // change
if(el.style.display != "block"){ // change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
/*sub menu code*/
function SwitchsubMenu(obj){
if(document.getElementById){
var sel = document.getElementById(obj);
var sar = document.getElementById("masterdiv").getElementsByTagName("span"); // change
if(sel.style.display != "block"){ // change
for (var i=0; i<sar.length; i++){
if (sar[i].className=="ssubmenu") // change
sar[i].style.display = "none";
}
sel.style.display = "block";
}else{
sel.style.display = "none";
}
}
}
<!--new code-->
/*sub menu code*/
function SwitchsubBMenu(obj){
if(document.getElementById){
var ssel = document.getElementById(obj);
var ssar = document.getElementById("masterdiv").getElementsByTagName("span"); // change
if(ssel.style.display != "block"){ // change
for (var i=0; i<ssar.length; i++){
if (ssar[i].className=="sssubmenu") // change
ssar[i].style.display = "none";
}
ssel.style.display = "block";
}else{
ssel.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"
}
if (persistmenu=="yes"){
var scookiename=(persisttype=="sitewide")? "sswitchmenu" : "s"+window.location.pathname
var scookievalue=get_cookie(scookiename)
if (scookievalue!="")
document.getElementById(scookievalue).style.display="block"
}
<!--more-->
if (persistmenu=="yes"){
var sscookiename=(persisttype=="sitewide")? "ssswitchmenu" : "ss"+window.location.pathname
var sscookievalue=get_cookie(sscookiename)
if (sscookievalue!="")
document.getElementById(sscookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
var sinc=1, sblockid=""
var ssinc=1, ssblockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
while (document.getElementById("ssub"+sinc)){
if (document.getElementById("ssub"+sinc).style.display=="block"){
sblockid="ssub"+sinc
break
}
sinc++
}
while (document.getElementById("sssub"+ssinc)){
if (document.getElementById("sssub"+ssinc).style.display=="block"){
ssblockid="sssub"+ssinc
break
}
ssinc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
var scookiename=(persisttype=="sitewide")? "sswitchmenu" : "s"+window.location.pathname
var scookievalue=(persisttype=="sitewide")? sblockid+";path=/" : sblockid
document.cookie=scookiename+"="+scookievalue
var sscookiename=(persisttype=="sitewide")? "ssswitchmenu" : "ss"+window.location.pathname
var sscookievalue=(persisttype=="sitewide")? ssblockid+";path=/" : ssblockid
document.cookie=sscookiename+"="+sscookievalue
}

jscheuer1
04-22-2005, 03:07 AM
I had a look at your code, pretty messy but, I think I see what you are trying to do. I've already put much of it 'right' but, need more time to finish. I'll be a little busy next few days so, if I don't get to it until next week, please be patient.

jscheuer1
04-22-2005, 02:25 PM
OK, I've gone about as far as I can with your code. It is so messy that I cannot figure out your intentions beyond what I will attach. In order to lay out a menu of this type and complexity, it would be best to diagram it first without anything that doesn't belong in the finished menu. Something like this:


Brazil
Legislation
Light Duty
specific title & link for Brazil Legislation Light Duty option one
specific title & link for Brazil Legislation Light Duty option two
Driving Cycles
specific title & link for Brazil Legislation Driving Cycles option one
specific title & link for Brazil Legislation Driving Cycles option two
Vendors
In Country
specific title & link for Brazil Vendors In Country option one
specific title & link for Brazil Vendors In Country option two
International
specific title & link for Brazil Vendors International option one
specific title & link for Brazil Vendors International option two
China
Legislation
Light Duty
specific title & link for China Legislation Light Duty option one
specific title & link for China Legislation Light Duty option two
Driving Cycles
specific title & link for China Legislation Driving Cycles option one
specific title & link for China Legislation Driving Cycles option two
Vendors
In Country
specific title & link for China Vendors In Country option one
specific title & link for China Vendors In Country option two
International
specific title & link for China Vendors International option one
specific title & link for China Vendors International option two
India
Legislation
Light Duty
specific title & link for India Legislation Light Duty option one
specific title & link for India Legislation Light Duty option two
Driving Cycles
specific title & link for India Legislation Driving Cycles option one
specific title & link for India Legislation Driving Cycles option two
Vendors
In Country
specific title & link for India Vendors In Country option one
specific title & link for India Vendors In Country option two
International
specific title & link for India Vendors International option one
specific title & link for India Vendors International option twoThat way, at least things would make some sense before laying out the markup. As it is I cannot really tell what you are shooting for. That being said, attached is the best I could make of your code. It works as you wrote it:

cuteNephilim
08-16-2005, 03:29 PM
I have two questions/requests regarding the Switch Menu submenu modification made by jscheuer1 in this thread:

1: I'd like all submenus to contract/close when clicking on a(nother) menu - if I don't contract the submeny myself, it will still be open if/when I return to that menu.

If that souldn't be clear, here's an example using the silly example layout below:

If I choose Vehicles -> Cars and then Computers, then going back to Vehicles, the Cars subfolder will still be open.

Vehicles
- Cars
-- Small cars
-- Big Cars
- Boats
-- Small boats
-- Big boats

Computers
- PC
-- Small PCs
-- Big BPs
- Mac
-- Small Macs
-- Big Macs

So what do I add where to automatically contract any open subfolder when clicking on a menu?

2: I would also like a link/function to close all open menus(and submenus ;). Maybe this can already be done by somehow SwitchMenu:ing an emty selection?

cedricv
08-22-2005, 08:21 AM
Hello, that's a trick : :confused:

I m looking for help to add the "persistence feature" to the "Tab Menu II (http://www.dynamicdrive.com/dynamicindex1/ddtabmenu2.htm) "
:eek:

Thanks for any help :D

cedricv
08-22-2005, 01:12 PM
hello,

I d'like to use same cookie persistence :o

Do you have any idea to use this persistence cookie for the Tab Menu II (http://www.dynamicdrive.com/dynamicindex1/ddtabmenu2.htm) ?

Any help will be welcome.


Thanks

GranoSalis
11-26-2005, 07:10 AM
Thanks a heap, jscheuer1, you obviously put a lot of time into that and it works like a charm!

teva@softhome.net
11-30-2005, 01:37 AM
Hey.

I'm using your addon and it works quite well. I only have one problem. I'm opening submenus with body onLoad="SwitchsubMenu('ssub3')" instead of onclick. Now, original submenus are working well, the problem i'm dealing with is, that subsubmenus are not working. Onclick works fine thou.
Any idea why is that?



<div class="submenutitle">something</div>
<span class="ssubmenu" id="ssub3">sub something</span>

<body onLoad="SwitchsubMenu('ssub3')">


...and here's how it looks

http://www.mobisux.com/album/data/4290/3602submenus.gif

benito
01-29-2006, 11:09 PM
Hi jscheuer1 ,

I tried your codes on the "Swith menu" with success except for one thing that I consider important. :eek:
The CSS "onmouse over" "onclick" "onmouseout"... don't work anymore except for the links themselves.
THE MENU and SUBMENU TITLES doens't respond anymore to these CSS functions... maybe too much SPAN or DIV...don't know

Can you help again :(

Thank you

Benito

jscheuer1
01-30-2006, 10:02 AM
Huh? Um - onmouseover, onmouseout and onclick are javascript events. The demo I made up worked fine, I think. Do you have a link to your problem page?

benito
01-31-2006, 06:02 PM
Sorry the page is not online yet but here the entire code, with css inside... in a zip file
Thanks a lot for your help.;)

jscheuer1
02-01-2006, 07:30 PM
Your choice of rollover colors is odd but, to get the rollovers to work, you need a script on the page like this one:


<script type="text/javascript">
function ChangeClass(id, clss){
document.getElementById(id).className=clss
}
</script>

It can go right after the style section, in the head of the page.

benito
02-03-2006, 10:00 AM
I see... I just copied your code over mine, ignoring that there was that little code on my page.... :eek:

developer82
04-17-2006, 08:08 PM
Hello,

*see below for code, and links to forum/dynamicdrive script

John, thank you for your work on modifying the script to include three levels. It works brilliantly, but I do have a question/problem/request.

I don't want to use onClick to call the switchMenu function because each page on my site has a page associated with it. The top most level in the menu are all landing pages. This means there are two actions happening -- a page loads and the nav bar expands to corresponding section. I have chosen to call the function in the body onLoad tag. This way, the two actions can happen idependently. THe page will load, and then the menu will open. Also, there is no need to use cookies (I don't think... or maybe that's my problem). Unfortunately when I try to execute this idea, the bottom-most level (the third level) does not stay expanded when the switch menu is called as the page loads. Help please! Is it not possible to use onLoad and get the third level?

I appreciate any advice. I don't want to waste time, if it's just not possible. Thank you! I hope someone can give insight :)

*Link to Forum post:
http://www.dynamicdrive.com/forums/showthread.php?t=2166
Link to Dynamic Drive Switch Menu I:
http://www.dynamicdrive.com/dynamicindex1/switchmenu.htm

----------------------
CODE:

In every body tag, SwitchMenu() is called onLoad (the following comes from the page: Term Info > Term I > page):

<body onLoad="SwitchMenu('ssub1')">

The Menu code:


<!--masterdiv-->
<div id="masterdiv">
<div class="menutitle"><a class="clA0" href="term.html">Term Info</a></div>
<span class="submenu" id="sub1">
<div class=submenutitle onclick="SwitchsubMenu('ssub1')"> Term I</div>
<span class=ssubmenu id="ssub1">
<a class="clA1" href="em1.html">Exiting</a>
<a class="clA1" href="op1.html">Operations</a>
<a class="clA1" href="hist1.html">History &amp; Facts</a>
<a class="clA1" href="contact1.html">Contact Us</a>
</span>
<div class=submenutitle onclick="SwitchsubMenu('ssub2')">Term II </div>
<span class=ssubmenu id="ssub2">
<a class="clA1" href="em2.html"> - Exiting </a>
<a class="clA1" href="op2.html">Operations</a>
<a class="clA1" href="hist2.html">History &amp; Facts</a>
<a class="clA1" href="contact2.html">Contact Us</a>
</span>
<!-- -->
</span>

<div class="menutitle"><a class="clA0" href="variet.html">Choices</a></div>
<span class="submenu" id="sub2">
<a class="clA1" href="cal.html">Calender</a>
<a class="clA1" href="tips.html">Tips</a>
</span>

<div class="menutitle"><a class="clA0" href="inter.html">Interests</a></div>

<div class="menutitle"><a class="clA0" href="plan.html">Planning</a></div>

<div class="menutitle"><a class="clA0" href="directions.html">Directions</a></div>
<span class="submenu" id="sub4">
<a class="clA1" href="dir1.html">Direction 1</a>
<a class="clA1" href="dir2.html">Direction 2</a>
</span>
</div>


My script (I've taken out the cookies):


// JavaScript Document
/***********************************************
* 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('.ssubmenu{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 SwitchsubMenu(obj){
if(document.getElementById){
var sel = document.getElementById(obj);
var sar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(sel.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<sar.length; i++){
if (sar[i].className=="ssubmenu") //DynamicDrive.com change
sar[i].style.display = "none";
}
sel.style.display = "block";
}else{
sel.style.display = "none";
}
}
}

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


---------------------------

teva@softhome.net... had the same question


Hey.

I'm using your addon and it works quite well. I only have one problem. I'm opening submenus with body onLoad="SwitchsubMenu('ssub3')" instead of onclick. Now, original submenus are working well, the problem i'm dealing with is, that subsubmenus are not working. Onclick works fine thou.
Any idea why is that?



<div class="submenutitle">something</div>
<span class="ssubmenu" id="ssub3">sub something</span>

<body onLoad="SwitchsubMenu('ssub3')">


...and here's how it looks

http://www.mobisux.com/album/data/4290/3602submenus.gif

developer82
04-17-2006, 08:28 PM
Hello all,

I have one more question. Without using cookies, is it possible to have "an active state" -- the loaded/current page? This is so the user can tell what page he/she is on within the menu. Does anyone know how to implement this in the script?

THank you... insight greatly appreciated..

jscheuer1
04-18-2006, 05:12 PM
Without using cookies, is it possible to have "an active state" -- the loaded/current page? This is so the user can tell what page he/she is on within the menu. Does anyone know how to implement this in the script?

Yes, working from the original DD code for this menu with cookies turned off (var persistmenu="no") but the cookie code intact, add this (red) to the onloadfunction():


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"
}
else
SwitchMenu('sub4')
}

where 'sub4' is the id of the menu contents you want expanded onload.

developer82
04-19-2006, 01:54 PM
Thank you John...

Wouldn't this mean the sub4 would always the "active" state by adding:
else
SwitchMenu('sub4')
}

What I would like to do, is perhaps call a different css style in the script so when the subx section is expanded, the appropriate link has some sort of distinguishable feature (bold, different bkgrd color, etc). I have the script and menu in a seperate file, and using an include in each page so that I don't have to modify the script/menu on each page of my site. So if I were to use a particular sub (ex sub4), then it would be expanded for all pages, right? Does this make sense?

Thanks so much :)

jscheuer1
04-19-2006, 02:57 PM
Yes, I had thought about that but, I was just answering your question as it was posed or as it appeared to me to be posed. If you are using this script externally, on each page that it is used on you could have added code that opens the content you wish and/or added style that highlights it the way you want. The best way(s) to do either or both of these things depend(s) upon just exactly how you are including this on each page and (in the case of having a specific content open) the exact javascript you are actually using (looking back over your posts, it looks like you already have this second part worked out, using the body onload event). With what you have posted, if the actual HTML markup of the menu is an include, I would suggest giving each header a unique id and then putting a style on each page that then individually highlights the header of your choice (this method would also work if the menu HTML is hard coded to each page but, inline style would be simpler in that case).

Example headers with unique ids:


<div class="menutitle" id="hd1"><a class="clA0" href="term.html">Term Info</a></div>

and:


<div class="menutitle" id="hd2"><a class="clA0" href="variet.html">Choices</a></div>

Example style for the specific page that is highlighting hd1 (use whatever property/value styling pairs you prefer):


<style type="text/css">
#hd1 {
font-weight:bold;
color:white;
}
</style>

izbaviboy
06-12-2008, 09:07 AM
I have database driven Switch Menu Additions - On Link1, Link2 and Link3 I generate this menu:

item A
item B
item C
- item C1
-- item C1a
-- item C1b
-- item C1c
- item C2
- item C3

On Link4 I generate this menu (without item C):
item A
item B
- item B1
-- item B1a
-- item B1b
- item B2
- item B3


When I click on Link1, Link2 and Link3 I need to have persistence of all opened menu and submenu and this is OK (Switch Menu Additions working fine).

But when I click on Link4 I have not item C and subitem of item C. So I need to have menu without persistence of sub items if new menu is different:

item A
item B
- item B1
- item B2
- item B3

Now I have Runtime Error: Object required - after debugging I see error in red line below:

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"
}
if (persistmenu=="yes"){
var scookiename=(persisttype=="sitewide")? "sswitchmenu" : "s"+window.location.pathname
var scookievalue=get_cookie(scookiename)
if (scookievalue!="")
document.getElementById(scookievalue).style.display="block"}
}


So how I can ''kill'' of persistence if new menu is different?!

tazdout4real
12-28-2009, 02:44 PM
Help with Switch Menu Additions.

I found the above code to add more submenus http://www.dynamicdrive.com/forums/showpost.php?p=8169&postcount=6,

However, I am unable to get it to work in my VS 2005. When I click on a switch menu, the links below it show as 1st level links instead of 2nd level links. Can anyone help? Here is my coding:


/* PageMaster2 Switchmenu peorperties */

.menutitle
{
cursor:pointer;
margin-bottom: 5px;
background-color: White;
color: black;
text-decoration:none;
width:140px;
padding:2px;
text-align:center;
font-weight:bold;
border:1px solid Black;/* */
}

.submenu a:link
{
text-indent: 10px;
color: Lime;
margin-bottom: 0.5em;
}

.submenu a:visited
{
color:Lime;
text-decoration:none;
}

.submenu a:hover
{
color: Red;
text-decoration:none;
background-position: 100% -32px;
}

.submenu a:selected
{
color: Red;
text-decoration:none;
}

/* ContentMaster Switchmenu peorperties */


.menucontent
{
background-color: #033668;
text-decoration:none;
color: White;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:16px;
cursor:pointer;
margin-bottom: 0px;
width:0px;
padding:0px;
text-align:left;
font-weight:bold;
/*/*/border:1px solid #000000;/* */
}

.submenucontent a:link
{
color: yellow;
text-indent: 10px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
text-decoration:none;
margin-bottom: 0.5em;
}

.submenucontent a:visited
{
color: Lime;
text-decoration:none;
}

.submenucontent a:hover
{
color: Red;
text-decoration:none;
background-position: 100% -32px;
}

.submenucontent a:selected
{
color: Aqua;
text-decoration:none;
}

.ssubmenucontent a:link
{
color: yellow;
text-indent: 10px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
text-decoration:none;
margin-bottom: 0.5em;
}

.ssubmenucontent a:visited
{
color: Lime;
text-decoration:none;
}

.ssubmenucontent a:hover
{
color: Red;
text-decoration:none;
background-position: 100% -32px;
}

.ssubmenucontent a:selected
{
color: Aqua;
text-decoration:none;
}

.ssubmenu
{
margin-bottom: 0.5em;
}

/***********************************************
* 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('.submenucontent{display: none;}\n')
document.write('.ssubmenucontent{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdivcontent").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=="submenucontent") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}

function SwitchsubMenu(obj){
if(document.getElementById){
var sel = document.getElementById(obj);
var sar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(sel.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<sar.length; i++){
if (sar[i].className=="ssubmenu") //DynamicDrive.com change
sar[i].style.display = "none";
}
sel.style.display = "block";
}else{
sel.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"
}
if (persistmenu=="yes"){
var scookiename=(persisttype=="sitewide")? "sswitchmenu" : "s"+window.location.pathname
var scookievalue=get_cookie(scookiename)
if (scookievalue!="")
document.getElementById(scookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
var sinc=1, sblockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
while (document.getElementById("ssub"+sinc)){
if (document.getElementById("ssub"+sinc).style.display=="block"){
sblockid="ssub"+sinc
break
}
sinc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
var scookiename=(persisttype=="sitewide")? "sswitchmenu" : "s"+window.location.pathname
var scookievalue=(persisttype=="sitewide")? sblockid+";path=/" : sblockid
document.cookie=scookiename+"="+scookievalue
}


<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<link href="PageMaster2.css" rel="stylesheet" type="text/css" />
<link href="Print.css" rel="stylesheet" type="text/css" media="print" />
<script language="javascript" type="text/javascript" src="../ContentScript.js"></script>
<script language="javascript" type="text/javascript" src="../PrintScript.js"></script>
<title>Page Master 2 Content Page</title>
</head>

<div id="masterdivcontent" onload="center" style="width:auto ">


<div class="menucontent" style="width:100%; "><a href="../Pages/Default.aspx" title="HOME">HOME</a></div>
<%--<span class="submenu" id="sub1" >
<asp:HyperLink ID="HyperLink25" runat="server" ForeColor="Lime" Font-Size="Medium" navigateurl="~/Pages/Default.aspx" text="Home" tooltip="Home"></asp:HyperLink>
</span>--%>


<div class="menucontent" style="width:100%;" onclick="SwitchMenu('sub1')">ASBESTOS / LEAD</div>
<span class="submenucontent" id="sub1">
<a href="/Pages/Asbestos.aspx" >Asbestos</a><br>
<a href="" >Cert/Trng</a><br>
<a href="" >Company</a><br>
<a href="" >School &amp; Accred.</a><br>
<a href="/Pages/Lead.aspx" >Lead</a><br />
<div class="ssubmenucontent" onclick="SwitchsubMenu('ssub1')">Lead Forms</div>
<span class=ssubmenu id=ssub1>
<a href="../Pages/FormLIBI622L.aspx">Registration for Lead Certification Exam</a><br />
</span>
<a href="../Pages/InspectorActivity.aspx" >Inspector Activity</a><br>
<a href="" >Violations</a>
</span>

<div class="menucontent" style="width:100%" onclick="SwitchMenu('sub2')">BEDDING &amp; UPHOLSTERY</div>
<span class="submenucontent" id="sub2">
<a href="" >New B &amp; U</a><br>
<a href="" >Permits</a><br>
<a href="" >Company</a><br>
<a href="" >Secondhand</a><br>
<a href="../Pages/InspectorActivity.aspx" >Inspector Activity</a><br>
<a href="" >Toys</a>
</span>
</div>

**I have edited out portions that do not apply to what I am doing.

jscheuer1
12-28-2009, 03:24 PM
Please post a new question in a new thread and follow the posting rules:

See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format.