layers einblenden und ausblenden

Samuel

Erfahrenes Mitglied
darum mal der code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>Untitled</title>
	<script language="JavaScript">
	var d = document;
	var menues = new Array("menue01", "menue02", "menue03");
	function showMenue(divName) {
	  if(d.all) {
	    for(var i = 0; i < menues.length; i++) {
		  if(divName == menues[i]) {
		    d.all[divName].style.visibility = "visible";
		  } else {
		    d.all[divName].style.visibility = "hidden";
		  }
		}
	  } else if((!d.all) && (d.getElementById)) {
	    for(var i = 0; i < menues.length; i++) {
		  if(divName == menues[i]) {
		    d.getElementByid(divName).style.visibility = "visible";
		  } else {
		    d.getElementByid(divName).style.visibility = "hidden";
		  }
		}
	  } else if(d.layers) {
	    for(var i = 0; i < menues.length; i++) {
		  if(divName == menues[i]) {
		    d.layers[divName].visibility = "show";
		  } else {
		    d.layers[divName].visibility = "hide";
		  }
		}
	  }
	}
	</script>
</head>

<body>
<a href="#" onclick="showMenue('menue01');">menue01</a>&nbsp;&nbsp;<a href="#" onclick="showMenue('menue02');">menue02</a>&nbsp;&nbsp;<a href="#" onclick="showMenue('menue03');">menue03</a>
<div id="menue01" style="position:absolute; top:100px; left:10px; height:50px; width:100px; background-Color:#CCCCCC; visibility:hidden;">
menue01
</div>
<div id="menue02" style="position:absolute; top:100px; left:115px; height:50px; width:100px; background-Color:#CCCCCC; visibility:hidden;">
menue02
</div>
<div id="menue03" style="position:absolute; top:100px; left:220px; height:50px; width:100px; background-Color:#CCCCCC; visibility:hidden;">
menue03
</div>
</body>
</html>

wenn einer ne antwort hat bin ich ihm sehr verbunden

thX im voraus

greetZZzz
 
so dashier ist die lösung!
war eigentlich nur ein denkfehler!
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 

<html> 
<head> 
   <title>Untitled</title> 
   <script language="JavaScript"> 
   var d = document; 
   var menues = new Array("menue01", "menue02", "menue03"); 
   function showMenue(divName) { 
     if(d.all) { 
       for(var i = 0; i < menues.length; i++) { 
        if(divName == menues[i]) { 
          d.all[menues[i].style.visibility = "visible"; 
        } else { 
          d.all[menues[i].style.visibility = "hidden"; 
        } 
      } 
     } else if((!d.all) && (d.getElementById)) { 
       for(var i = 0; i < menues.length; i++) { 
        if(divName == menues[i]) { 
          d.getElementById(menues[i]).style.visibility = "visible"; 
        } else { 
          d.getElementById(menues[i]).style.visibility = "hidden"; 
        } 
      } 
     } else if(d.layers) { 
       for(var i = 0; i < menues.length; i++) { 
        if(divName == menues[i]) { 
          d.layers[menues[i].visibility = "show"; 
        } else { 
          d.layers[menues[i].visibility = "hide"; 
        } 
      } 
     } 
   } 
   </script> 
</head> 

<body> 
<a href="javascript:showMenue('menue01');">menue01</a>&nbsp;&nbsp;<a href="javascript:showMenue('menue02');">menue02</a>&nbsp;&nbsp;<a href="javascript:showMenue('menue03');">menue03</a> 
<div id="menue01" style="position:absolute; top:100px; left:10px; height:50px; width:100px; background-Color:#CCCCCC; visibility:hidden;"> 
menue01 
</div> 
<div id="menue02" style="position:absolute; top:100px; left:115px; height:50px; width:100px; background-Color:#CCCCCC; visibility:hidden;"> 
menue02 
</div> 
<div id="menue03" style="position:absolute; top:100px; left:220px; height:50px; width:100px; background-Color:#CCCCCC; visibility:hidden;"> 
menue03 
</div> 
</body> 
</html>

greetZZzz daIllu ;-)
 

Neue Beiträge

Zurück