Thread Div-Box auf und zuklappen (19 answers)
Opened by pktm at 2005-07-15 19:56

FIFO
 2012-12-01 15:10
#163821 #163821
User since
2005-06-01
469 Artikel
BenutzerIn

user image
Deine Variante funktioniert (zumindest bei mir) nicht mit mehreren DIVs. Lässt man die _shown/_hidden-Zuweisungen weg, dann funktionierts:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<html>
<head>
<script language="JavaScript">
function div_change() {
for (i = 0; i < div_change.arguments.length; i++) {
var _id = div_change.arguments[i];
document.getElementById(_id).style.display = (document.getElementById(_id).style.display == 'none' ) ? 'block' : 'none';
}
}
</script>
</head>
<body>
<div>Dies ist ein normales Div...</div><br><br>
<a href="javascript:/" onClick="div_change(1,2)">Div ein-/ausblenden</a><br><br>
<div id="1" style="display: none">DIV 1, Default: Versteckt.</div>
<div id="2">DIV 2, Default: Sichtbar.</div>
</body>
</html>
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it? -- Brian Kernighan: "The Elements of Programming Style"

View full thread Div-Box auf und zuklappen