Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Layering
Message
De
17/03/2003 03:45:37
 
 
À
Tous
Information générale
Forum:
Internet
Catégorie:
Javascript
Titre:
Layering
Divers
Thread ID:
00766460
Message ID:
00766460
Vues:
52
Hey
can someone please help.

I have made a page which has 3 layers on it which are activated by respective buttons. Each button shows one layer and hides the other two. I have used available code and changed it a bit to suit me but I keep getting an error message with
document.all.layer0.style.visibility = "hidden"; in function hideAllLayers()
I am using IE

This is what I have:
<script language="javascript"  type="text/javascript">

var isNS4=document.layers?true:false;
var isIE=document.all?true:false;
var isNS6=!isIE&&document.getElementById?true:false;
if(isNS4)

{
document.write("NS4:<BR>");
document.write('<LAYER name="layer0" LEFT=50 width=400><BR CLEAR="ALL"></LAYER>');
document.write('<LAYER name="layer1" LEFT=50  width=400  VISIBILITY="HIDE"><BR CLEAR="ALL"></LAYER>');
document.write('<LAYER name="layer2" LEFT=50  width=400  VISIBILITY="HIDE"><BR CLEAR="ALL"></LAYER>');
}
if(isIE||isNS6)
{
  if(isIE)
    document.write("IE:<BR>");
  else
    document.write("NS6:<BR>");
  	document.write('<div id="layer0" LEFT=50 width=400><BR CLEAR="ALL"><HR></div>');
 	document.write('<div id="layer1" LEFT=50 width=400 style="visibility:hidden;"><<BR CLEAR="ALL"><HR></div>');
	document.write('<div id="layer2" LEFT=50 width=400 style="visibility:hidden;"><<BR CLEAR="ALL"><HR></div>');
}


// this function hides all the  layers 

function hideAllLayers() { 
if(isNS4)
{
document.layer0.visibility = "hide"; 
document.layer1.visibility = "hide"; 
document.layer2.visibility = "hide"; 
}
if(isIE)
{
document.all.layer0.style.visibility = "hidden"; 
document.all.layer1.style.visibility = "hidden"; 
document.all.layer2.style.visibility = "hidden"; 
}
if(isNS6)
{
document.getElementById("layer0").style.visibility = "hidden"; 
document.getElementById("layer1").style.visibility = "hidden"; 
document.getElementById("layer2").style.visibility = "hidden"; 
}
} 

// this function makes a single layer visible 
//  named the layers so can tell which one to show based on the selectedIndex of the menu 

function changeLayer(n) { 
hideAllLayers(); 
if(isNS4)
{
document.layers["layer" + n].visibility = "show"; 
}
if(isIE)
{
eval("document.all.layer"+n+".style.visibility='visible';");
}
if(isNS6)
{
document.getElementById("layer"+n).style.visibility = "visible"; 
}
}
Répondre
Fil
Voir

Click here to load this message in the networking platform