Christoph Schnauß: <div> dynamisch ein-ausschalten

Beitrag lesen

hallo,

Quellcode (Ausschnitt :) )

Warum so umständlich? Nimm einen EventHandler und schreib da ein bißchen CSS rein, und alles wird gut. Schematisch (du mußt das natürlich anpassen) geht das z.B. in einer Tabelle so:

<table border="1"cellspacing="1"><tr>
<td id="z1">Zeile 1</td>
</tr><tr>
<td id="z2" onClick="document.getElementById('z3').style.display='block'; this.style.display='none'" style="display:none; cursor:pointer">Zeile 2</td>
<td id="z3" onClick="document.getElementById('z2').style.display='block'; this.style.display='none'" style="cursor:pointer">Zeile 3</td>
</tr></table>

Grüße aus Berlin

Christoph S.