Seite 1 von 1

kasten erscheint, obwohl er es nicht soll

Verfasst: 26.05.2007 13:04
von phpbbalex

Code: Alles auswählen

<div style="margin:20px; margin-top:5px"><div style="font: 11px Verdana, Geneva, Lucida, 'Lucida Grande'; margin-bottom:2px"><b>Spoiler:</b> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';      this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }" /></div><div style="min-height: 20px; background-color: #EDE8E0; margin: 0px; padding: 6px; border: 1px inset;"><div style="display: none;">{TEXT}</div></div></div>
diesen code habe ich für einen bb code gefunden.
er funktioniert soweit auch ganz gut, aber auch wenn der text eigentlich ausblendet werden sollte wird eine graue box angezeigt, ich will aber, dass dann nur der button angezeigt wird, was muss ich dafür verändern?

Verfasst: 26.05.2007 13:32
von Z_Beeblebrox
Hi,

lösche einfach immer das:

Code: Alles auswählen

getElementsByTagName('div')[0].
Und füge das

Code: Alles auswählen

display: none;
ein Element höher ein.

Außerdem kannst Du das dann das div um {TEXT} entfernen.

Sollte dann so aussehen:

Code: Alles auswählen

<div style="margin:20px; margin-top:5px">
<div style="font: 11px Verdana, Geneva, Lucida, 'Lucida Grande'; margin-bottom:2px"><b>Spoiler:</b> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].style.display = ''; this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }" /></div><div style="min-height: 20px; background-color: #EDE8E0; margin: 0px; padding: 6px; border: 1px inset; display: none;">{TEXT}</div></div>

Verfasst: 26.05.2007 14:09
von phpbbalex
vielen dank hat funktioniert