23.07.2011, 18:29
Grad mal so getestet:
Ausgabe:
PHP-Code:
$message = <<<MESSAGE
<div>
<div class="spoiler_header">
Test
<a href="javascript:void(0);" onclick="javascript:if(parentNode.parentNode.getElementsByTagName('div')[1].style.display=='block'){parentNode.parentNode.getElementsByTagName('div')[1].style.display='none';this.innerHTML='<button>Ausklappen</button>';}else {parentNode.parentNode.getElementsByTagName('div')[1].style.display='block';this.innerHTML='<button>Einklappen</button>';}"><button>Ausklappen</button></a>
</div>
<div class="spoiler_body" style="display: none;">Lorem ipsum</div>
</div>
MESSAGE;
echo alglinker_run( $message );
Ausgabe:
Code:
<div>
<div class="spoiler_header">
Test
<a href="javascript:void(0);" onclick="javascript:if(parentNode.parentNode.getElementsByTagName('div')[1].style.display=='block'){parentNode.parentNode.getElementsByTagName('div')[1].style.display='none';this.innerHTML='<button>Ausklappen</button>';}else {parentNode.parentNode.getElementsByTagName('div')[1].style.display='block';this.innerHTML='<button>Einklappen</button>';}"><button>Ausklappen</button></a>
</div>
<div class="spoiler_body" style="display: none;">Lorem ipsum</div>
</div>