Layer anzeigen/verstecken
Wilas
- javascript
0 Julius0 Axel Richter
Hi!
Ich weiß jetzt wirklich nicht mehr, was falsch in meinem Code ist:
_________________________________________
<html>
<head>
<title>layertest</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
function hideLayer(layerName) {
layerName.style.visibility = 'hidden';
}
function showLayer(layerName) {
layerName.style.visibility = 'visible';
}
</script>
<style type="text/css">
#layerSwitchOn {
visibility: visible;
position:absolute; left:100px; top:100px; width:80px; height:20px;
background-color: #999999;
border : thin solid Black;
}
#layerSwitchOff {
visibility: hidden;
position:absolute; left:100px; top:100px; width:80px; height:20px;
background-color: #333333;
border : thin solid Black;
}
#layerDetails {
visibility: hidden;
position:absolute; left:100px; top:300px; width:300px; height:200px;
background-color: #e1e1e1;
border : thin solid Black;
}
</style>
</head>
<body>
<div id="layerSwitchOn"><a href="javascript:;" onClick="hideLayer('layerSwitchOn');showLayer('layerDetails');showLayer('layerSwitchOff')">switch On!</a></div>
<div id="layerSwitchOff">switch Off!</div>
<div id="layerDetails">hier sind die details!</div>
</body>
</html>
_________________________________________
Wäre sehr dankbar, wenn mir jemand weiterhelfen könnte...
LG
Wilas
Hi!
HI !
Ich weiß jetzt wirklich nicht mehr, was falsch in meinem Code ist:
das is dumm!
_________________________________________
<html>
<head>
<title>layertest</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
function hideLayer(layerName) {
layerName.style.visibility = 'hidden';
ich denke das heisst layerName.style.visibility = 'hide';
}
function showLayer(layerName) {
layerName.style.visibility = 'visible';
hier auch visibility = 'hide';
}
</script>
<style type="text/css">
#layerSwitchOn {
visibility: visible;
position:absolute; left:100px; top:100px; width:80px; height:20px;
background-color: #999999;
border : thin solid Black;
}
#layerSwitchOff {
visibility: hidden;
position:absolute; left:100px; top:100px; width:80px; height:20px;
background-color: #333333;
border : thin solid Black;
}
#layerDetails {
visibility: hidden;
position:absolute; left:100px; top:300px; width:300px; height:200px;
background-color: #e1e1e1;
border : thin solid Black;
}
</style>
</head>
<body>
<div id="layerSwitchOn"><a href="javascript:;" onClick="hideLayer('layerSwitchOn');showLayer('layerDetails');showLayer('layerSwitchOff')">switch On!</a></div>
<div id="layerSwitchOff">switch Off!</div>
<div id="layerDetails">hier sind die details!</div>
</body>
</html>
_________________________________________
Wäre sehr dankbar, wenn mir jemand weiterhelfen könnte...
jo, immer doch
ciao
Julius
Hi!
function hideLayer(layerName) {
//DOM
if(document.getElementById)
document.getElementById(layerName).style.visibility = 'hidden';
//IE
if(document.all)
document.all[layerName].style.visibility = 'hidden';
//Netscape4.x ohne Garantie
if(document.layers)
document.layers[layerName].style.visibility = 'hidden';
}
function showLayer(layerName) {
//DOM
if(document.getElementById)
document.getElementById(layerName).style.visibility = 'visible';
//IE
if(document.all)
document.all[layerName].style.visibility = 'visible';
//Netscape4.x ohne Garantie
if(document.layers)
document.layers[layerName].style.visibility = 'visible';
}
Gruß
Axel