This JavaScript is working properly when using Internet Explorer, but this Script is not working when using Mozilla Firefox or Google Chrome. Please Help me re-encode this. Thank you. Here's the Script:
<html>
<head>
<title>Test Tree</title>
<style type="text/css">
a
{text-decoration: none;}
.title
{position: absolute;
left: 35px;
width: 150px;
height: 20px;
z-index: 10;
font-family: verdana, helvetica, sans-serif;
font-weight: bold;
font-size: 12px;}
.submenu
{position: absolute;
left: 40px;
width: 120px;
border: 0px solid black;
background-color: white;
layer-background-color: white;
font-family: verdana, helvetica, sans-serif;
font-size: 10px;
visibility: hidden;}
</style>
<SCRIPT LANGUAGE="JavaScript">
//nom is the number of menus on your tree, change this if your want more menus
var nom = 16; // Number of menus
var usePictures = 1;
var ttls = new Array();
var subs = new Array();
var lastn;
var lastmove;
if (document.layers) {
visible = 'show';
hidden = 'hide';
}
else
if (document.all) {
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 = "open.gif";
}
else if (document.all) {
document.all(pic).src = "open.gif";
}
}
function picclose(n) {
title = ('title' + n);
pic = ('pic' + n);
if (document.layers) {
document.layers[title].document.images[pic].src = "closed.gif";
}
else if (document.all) {
document.all(pic).src = "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;
}
if (submenu.visibility == visible) {
submenu.visibility = hidden;
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;
}
}
}
}
}
function toggle(n,move) {
menu = ('submenu' + n);
if (document.layers) {
submenu = document.layers[menu];
}
else if (document.all) {
submenu = document.all(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 {
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;
}
if (document.all) {
document.all(ttls[i]).style.pixelTop += move;
document.all(subs[i]).style.pixelTop += move;
}
}
}
lastn = n;
lastmove = move;
}
</script>
</head>
<body>
<div id="iFrame1" style="position:absolute; left:162px; top:12px; z-index:0">
<iframe name="iFrame1" width="1100" height="550" src="http://yahoo.com" scrolling="yes" frameborder="0"></iframe>
</div>
<div class="title" id="title1" style="top: 120px">
<a href="#" onclick="javascript: toggle(1,60); return false"><img name="pic1" src="closed.gif" border="0"> Browser TS</a>
</div>
<div class="submenu" id="submenu1" style="top: 140px">
<img src="line.gif" border="0"><a href="http://www.yahoo.com" target="iFrame1">Clear Cache</a><br>
<img src="line.gif" border="0"><a href="http://www.google.com" target="iFrame1">Add-Ons</a><br>
<img src="line.gif" border="0"><a href="http://www.youtube.com" target="iFrame1">JavaScript</a><br>
<img src="line.gif" border="0"><a href="http://www.yahoo.com">Downloads</a>
</div>
</body>
</html>
That's the code, please check it why it's not working on Firefox or Google Chrome.. I hope someone can help me. Thank you.