Hallo,
ich möchte die Anzeige von verschiedenen Containern tauschen!
Ich habe acht Container, die je nach Auswahl angezeigt werden sollen. Der vorherige muss natürlich weg.
Die folgende Funktion macht den neuen Container zwar sichtbar, aber schaltet den alten nicht ab.
function verstecke2(Pos) {
for (var x = 0; x <= 8; x++) {
var DIV_name = "form_" + Pos
var DIV_Style = document.getElementById(DIV_name).style.display;
if ( Number == x ) {
document.getElementById(DIV_name).style.display = "block";
}
else {
if ( DIV_Style == "block" ) {
document.getElementById(DIV_name).style.display = "none";
}
}
}
}
HTML:
<div id="form_0">
<p>Start</p>
</div>
<div id="form_1">
<p>Seite 1</p>
</div>
CSS
#form_0 {
position:absolute;
display:block;
left:150px;
top:150px;
width:300px;
height:150px;
}
#form_1 {
position:absolute;
display:none;
left:150px;
top:150px;
width:300px;
height:150px;
}