Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This javascript works in IE but not Chrome or Firefox or Safari. Why?

Status
Not open for further replies.

mminorhsd

Programmer
Apr 16, 2013
2
The javascript listed below works fine in IE, but not chrome, firefox or safari. It creates a drop down menu, hiding the menu options until you mouseover the top layer of one of the menu options. I have tested it with various online validator sites and it doesn't show any errors. Is there something in it that Chrome, FF and Safari doesn't support?

<SCRIPT LANGUAGE=JAVASCRIPT TYPE=text/JAVASCRIPT>
<!--
No3 = (parseInt(navigator.appVersion,10) > 3) ? 1:0;
layer = (document.all && No3) ? "document.all['L'+menu].style" : (document.layers && No3) ? "document.layers['L'+menu]" : 0;
var timer;

function Show() { if(layer) {
if(timer) { clearTimeout(timer); }
for(menu=0; menu<Layer.length; menu++) { if(Layer[menu]) { eval(layer).visibility = "hidden"; } }
for(i=0; i<arguments.length; i++) { menu=arguments; eval(layer).visibility = "visible"; }
} }
function Hide() { timer = setTimeout("Show()", 500); }
//-->

</SCRIPT>
<P></P msnavigation></SPAN></TD></TR></TBODY msnavigation></TABLE><DIV ALIGN=CENTER>
<TABLE border="1" cellpadding="0" cellspacing="0" WIDTH="900" HEIGHT="17" bgcolor=#4682B4 bordercolordark="#FFFFFF" bordercolor="#000080" bordercolorlight="#C0C0C0">
<tr>

<td WIDTH="150" align="center" bgcolor="#999999" ><b><A onmouseover=Show(1) onmouseout=Hide(1) HREF=" of Sale</A></b></td>
<td WIDTH="150" align="center" bgcolor="#999999" ><b><A onmouseover=Show(2) onmouseout=Hide(2) HREF=" Book</A></b></td>
</tr>
</TABLE>
<SCRIPT LANGUAGE=JAVASCRIPT>
<!--

//////////////////////////////////////////////////////

hovercolor = "#CCCCCC"; // color name/code
bgcolor = "#999999"; // color name/code
background = ""; // picture url

menu_border = 1; // IE only
border_color = "white"; // IE only

arrow_pic = " // url of arrow picture for submenus

//////////////////////////////////////////////////////


if(document.all) { if(!background) { background=bgcolor; } else { background = "url("+background+")"; } }

function LayerSpecs(Left,Top,Width) { if(No3) {
if(document.all) { Top+=7; Left+=2; Width+=56; }
this.left = Left;
this.top = Top;
this.info = "";
T=0;
for(i=3; i<arguments.length; i++) {
if(document.all) { this.info += "<TR><TD WIDTH="+Width+" onMouseOver='this.bgColor=\""+hovercolor+"\"' onMouseOut='this.bgColor=\"\"'>"+arguments+"</TD></TR>"; }
else { this.info += "<LAYER onMouseOver='this.bgColor=\""+hovercolor+"\"' onMouseOut='this.bgColor=\""+bgcolor+"\"' WIDTH="+Width+" POSITION=RELATIVE TOP="+T+">&nbsp;"+arguments+"</LAYER>"; }
T+=20;
}
} }

Layer = new Array();
arrow = "<IMG SRC='"+arrow_pic+"' WIDTH=6 HEIGHT=10 BORDER=0 ALT=''>";


//////////////////////////////////////////////

Layer[1] = new LayerSpecs(70,24,140,
'<img border="0" src=" width="13" height="12"><A HREF= </A>',
'<img border="0" src=" width="13" height="12"><A HREF= Out Day </A>');

Layer[2] = new LayerSpecs(205,24,140,
'<img border="0" src=" width="13" height="12"><A HREF= Appointment </A>',
'<img border="0" src=" width="13" height="12"><A HREF= Appointments </A>');

////////////////////////////////////////////////////////////////

j = (Layer[0]) ? 0:1;

for(i=j; i<Layer.length; i++) {
if(document.all && No3) { document.write("<SPAN onMouseOver='clearTimeout(timer)' onMouseOut='Hide("+i+")' ID='L"+i+"' STYLE='position:absolute; visibility:hidden; background:"+background+"; top:"+Layer.top+"; left:"+Layer.left+";'><TABLE STYLE='border:solid "+menu_border+" "+border_color+"'>"+Layer.info+"</TABLE></SPAN>"); }
else if(document.layers && No3) { document.write("<LAYER onMouseOver='clearTimeout(timer)' onMouseOut='Hide("+i+")' ID='L"+i+"' POSITION=ABSOLUTE VISIBILITY=HIDDEN BGCOLOR='"+bgcolor+"' BACKGROUND='"+background+"' TOP="+Layer.top+" LEFT="+Layer.left+">"+Layer.info+"</LAYER>"); }
}

// -->

</SCRIPT>

any help will be greatly appreciated.
 
Code:
<SCRIPT LANGUAGE=JAVASCRIPT TYPE=text/JAVASCRIPT> 
<!-- 
No3 = (parseInt(navigator.appVersion,10) > 3) ? 1:0; 
layer = (document.all && No3) ? "document.all['L'+menu].style" : (document.layers && No3) ? "document.layers['L'+menu]" : 0; 
var timer; 

function Show() { if(layer) { 
if(timer) { clearTimeout(timer); } 
for(menu=0; menu<Layer.length; menu++) { if(Layer[menu]) { eval(layer).visibility = "hidden"; } } 
for(i=0; i<arguments.length; i++) { menu=arguments[i]; eval(layer).visibility = "visible"; } 
} } 
function Hide() { timer = setTimeout("Show()", 500); } 
//--> 

</SCRIPT> 
<P></P msnavigation></SPAN></TD></TR></TBODY msnavigation></TABLE><DIV ALIGN=CENTER> 
<TABLE border="1" cellpadding="0" cellspacing="0" WIDTH="900" HEIGHT="17" bgcolor=#4682B4 bordercolordark="#FFFFFF" bordercolor="#000080" bordercolorlight="#C0C0C0"> 
<tr> 

<td WIDTH="150" align="center" bgcolor="#999999" ><b><A onmouseover=Show(1) onmouseout=Hide(1) HREF="[URL unfurl="true"]http://64.34.174.209/scripts/mgwms32.dll?MGWCHD=0&...">Point[/URL] of Sale</A></b></td> 
<td WIDTH="150" align="center" bgcolor="#999999" ><b><A onmouseover=Show(2) onmouseout=Hide(2) HREF="[URL unfurl="true"]http://64.34.174.209/scripts/mgwms32.dll?MGWCHD=0&...">Appointment[/URL] Book</A></b></td> 
</tr> 
</TABLE> 
<SCRIPT LANGUAGE=JAVASCRIPT> 
<!-- 

////////////////////////////////////////////////////// 

hovercolor = "#CCCCCC"; // color name/code 
bgcolor = "#999999"; // color name/code 
background = ""; // picture url 

menu_border = 1; // IE only 
border_color = "white"; // IE only 

arrow_pic = "[URL unfurl="true"]http://zcodesystems.com/img/rarrow.gif";[/URL] // url of arrow picture for submenus 

////////////////////////////////////////////////////// 


if(document.all) { if(!background) { background=bgcolor; } else { background = "url("+background+")"; } } 

function LayerSpecs(Left,Top,Width) { if(No3) { 
if(document.all) { Top+=7; Left+=2; Width+=56; } 
this.left = Left; 
this.top = Top; 
this.info = ""; 
T=0; 
for(i=3; i<arguments.length; i++) { 
if(document.all) { this.info += "<TR><TD WIDTH="+Width+" onMouseOver='this.bgColor=\""+hovercolor+"\"' onMouseOut='this.bgColor=\"\"'>"+arguments[i]+"</TD></TR>"; } 
else { this.info += "<LAYER onMouseOver='this.bgColor=\""+hovercolor+"\"' onMouseOut='this.bgColor=\""+bgcolor+"\"' WIDTH="+Width+" POSITION=RELATIVE TOP="+T+">&nbsp;"+arguments[i]+"</LAYER>"; } 
T+=20; 
} 
} } 

Layer = new Array(); 
arrow = "<IMG SRC='"+arrow_pic+"' WIDTH=6 HEIGHT=10 BORDER=0 ALT=''>"; 


////////////////////////////////////////////// 

Layer[1] = new LayerSpecs(70,24,140,
'<img border="0" src="[URL unfurl="true"]http://zcodesystems.com/img/lc_arrow_right.gif"[/URL] width="13" height="12"><A HREF=[URL unfurl="true"]http://64.34.174.209/scripts/mgwms32.dll?MGWLPN=LO...[/URL] </A>', 
'<img border="0" src="[URL unfurl="true"]http://zcodesystems.com/img/lc_arrow_right.gif"[/URL] width="13" height="12"><A HREF=[URL unfurl="true"]http://64.34.174.209/scripts/mgwms32.dll?MGWLPN=LO...[/URL] Out Day </A>');

Layer[2] = new LayerSpecs(205,24,140,
'<img border="0" src="[URL unfurl="true"]http://zcodesystems.com/img/lc_arrow_right.gif"[/URL] width="13" height="12"><A HREF=[URL unfurl="true"]http://64.34.174.209/scripts/mgwms32.dll?MGWLPN=LO...[/URL] Appointment </A>', 
'<img border="0" src="[URL unfurl="true"]http://zcodesystems.com/img/lc_arrow_right.gif"[/URL] width="13" height="12"><A HREF=[URL unfurl="true"]http://64.34.174.209/scripts/mgwms32.dll?MGWLPN=LO...[/URL] Appointments </A>');

//////////////////////////////////////////////////////////////// 

j = (Layer[0]) ? 0:1; 

for(i=j; i<Layer.length; i++) { 
if(document.all && No3) { document.write("<SPAN onMouseOver='clearTimeout(timer)' onMouseOut='Hide("+i+")' ID='L"+i+"' STYLE='position:absolute; visibility:hidden; background:"+background+"; top:"+Layer[i].top+"; left:"+Layer[i].left+";'><TABLE STYLE='border:solid "+menu_border+" "+border_color+"'>"+Layer[i].info+"</TABLE></SPAN>"); } 
else if(document.layers && No3) { document.write("<LAYER onMouseOver='clearTimeout(timer)' onMouseOut='Hide("+i+")' ID='L"+i+"' POSITION=ABSOLUTE VISIBILITY=HIDDEN BGCOLOR='"+bgcolor+"' BACKGROUND='"+background+"' TOP="+Layer[i].top+" LEFT="+Layer[i].left+">"+Layer[i].info+"</LAYER>"); }
} 

// --> 

</SCRIPT>

Is this what you meant Darren? I'm new to the forum and am unfamiliar with the customs of this site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top