Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with menu script
Message
 
À
Tous
Information générale
Forum:
Internet
Catégorie:
Javascript
Titre:
Help with menu script
Divers
Thread ID:
00854707
Message ID:
00854707
Vues:
72
Hey all, I need some advice on the following JavaScript, which I adapted from a free source. It works great in IE, but only in IE, and only on PC's. Navigator, Opera and Macs all ignore the script and the style sheet associated with the file. Any wisdom will be deeply appreciated.
<style type="text/css">
a
{text-decoration: none;}
a:link {
color:#408080;
background:#FFFFFF;
}
a:visited{
color {
color:#004080;
background:#FFFFFF;
}
.title
{position: absolute;
width: 150px;
height: 20px;
left: 10px;
z-index: 10;
font-family: Arial, verdana, helvetica, sans-serif;
font-weight: bold;
font-size: 14px;}

.submenu
{position: absolute;
left: 30px;
width: 175px;
border: 0px solid black;
background-color: transparent;
layer-background-color: #FFFFFF;
font-family: Arial, verdana, helvetica, sans-serif;
font-size: 12px;
font-style: italic;
link-color: #0000FF;
visibility: hidden;}
</style>
<script LANGUAGE="JavaScript">


<!-- Begin

// ADDITIONAL NOTES
// The input variables to the toggle function are the number of the submenu to open/close,
// starting with 0, and the number of pixels to move the objects below.
// For example toggle(1,60) opens/closes the second submenu and moves the objects below 60 pixels.
if (navigator.appName !=="Netscape"){
     var nom = 5; // Number of menus
     var usePictures = 1; // use pictures?  1 = yes, 0 = no
     
     var ttls = new Array(); // An array for the title objects
     var subs = new Array(); // An array for the submenu objects
     var lastn;
     var lastmove;
     
     if (document.layers) {
     	visible = 'show';
     	hidden = 'hide';
     	}
     else
     	if (document.all || document.getElementById) {
     		visible = 'visible';
     		hidden = 'hidden';
     		}
     for (var i = 1; i <= nom; i++) {
     	ttls[i] = ('title' + i);
     	subs[i] = ('submenu' +i);
     	}
     function picopen(n) {
     	title = ('title' + n);
     	pic = ('pic' + n);
     	if (document.layers) {
     		document.layers[title].document.images[pic].src = "../images/opened.gif";
     		}
     	else if (document.all) {
     		document.all(pic).src = "../images/opened.gif";
     		}
     	else if (document.getElementById) {
     		document.getElementById(pic).src = "../images/opened.gif";
     		}
     	}
     function picclose(n) {
     	title = ('title' + n);
     	pic = ('pic' + n);
     	if (document.layers) {
     		document.layers[title].document.images[pic].src = "../images/closed.gif";
     		}
     	else if (document.all) {
     		document.all(pic).src = "../images/closed.gif";
     		}
     	else if (document.getElementById) {
     		document.getElementById(pic).src = "../images/closed.gif";
     		}
     	}
     lastn = (nom + 1);
     lastmove = 0;
     function lasttoggle(n,move) {
     	if (n <= nom) {
     		menu = ('submenu' + n);
     		if (document.layers) {
     			submenu = document.layers[menu];
     			}
     		else if (document.all) {
     			submenu = document.all(menu).style;
     			}
     		else if (document.getElementById) {
     			submenu = document.getElementById(menu).style;
     			}
     		if (submenu.visibility == visible) {
     			submenu.visibility = hidden;
     			picclose(n); // Remove this if you don't use pictures
     			for (var i = (n+1); i <= nom; i++) {
          				if (document.layers) {
          					document.layers[ttls[i]].top -= move;
          					document.layers[subs[i]].top -= move;
          					}
          				else if (document.all) {
          					document.all(ttls[i]).style.pixelTop -= move;
          					document.all(subs[i]).style.pixelTop -= move;
          		        		}
          				else if (document.getElementByID) {
          					document.getElementById(ttls[i]).style.pixelTop -= move;
          					document.getElementById(subs[i]).style.pixelTop -= move;
          					}
     				}
     			}
     		}
     	}
     function toggle(n,move) {
     	menu = ('submenu' + n);
     	if (document.layers) {
     		submenu = document.layers[menu];
     		}
     	else if (document.all) {
     		submenu = document.all(menu).style;
     		}
     	else if (document.getElementById) {
     		submenu = document.getElementById(menu).style;
     		}
     	if (submenu.visibility == visible) {
     		submenu.visibility = hidden;
     		if (usePictures) picclose(n);
     			for (var i = (n+1); i <= nom; i++) {
     				if (document.layers) {
     					document.layers[ttls[i]].top -= move;
     					document.layers[subs[i]].top -= move;
     					}
     				else if (document.all) {
     					document.all(ttls[i]).style.pixelTop -= move;
     					document.all(subs[i]).style.pixelTop -= move;
     					}
     				else if (document.getElementById) {
     					document.getElementById(ttls[i]).style.pixelTop -= move;
     					document.getElementById(subs[i]).style.pixelTop -= move;
     					}
        				}
     		}
     	else {
     		submenu.visibility = visible;
     		if (usePictures) picopen(n);
     			if (lastn != n) {
     				lasttoggle(lastn,lastmove);
     				}
     			for (var i = (n+1); i <= nom; i++) {
     				if (document.layers) {
     					document.layers[ttls[i]].top += move;
     					document.layers[subs[i]].top += move;
     					}
     				else if (document.all) {
     					document.all(ttls[i]).style.pixelTop += move;
     					document.all(subs[i]).style.pixelTop += move;
     					}
     				else if (document.getelementById) {
     					document.getElementById(ttls[i]).style.pixelTop += move;
     					document.getelementById(subs[i]).style.pixelTop += move;
           					}
        				}
     		}
     lastn = n;
     lastmove = move;
     }

}
//  End -->
</script>
</head>
<body id="splash">
<table height="50%" border="0">
<tr rowspan="14">
<td>
<div class="title" id="title1" style="top:20px">
<a href="#" onclick="javascript: toggle(1,60); return false"><img id="pic1" src="../images/closed.gif" border="0" align="center"> Products</a><br>
</div>

<div class="submenu" id="submenu1" style="top:40px">
 <a href="../html/FundSuiteSX.html" target="contentFrame">FundSuite SX</a><br>
 <a href="../html/FundSuitecomtext.html"target="contentFrame">FundSuite ComText</a><br>
 <a href="../html/FundSuitensar.html"target="contentFrame">FundSuite ComFiler</a><br>
 <a href="../html/FundSuitetaxtrax.html" target="contentFrame">FundSuite TaxTrax</a><br>
</div>
<br>
Robert J. Ohrstedt
RJO Associates
Répondre
Fil
Voir

Click here to load this message in the networking platform