Para usar este spoiler sólo hace falta pegar este código:
<div><a href='#'
onclick="if(this.parentNode.getElementsByTagName('div')[0].style.display
!= ''){this.parentNode.getElementsByTagName('div')[0].style.display =
'';this.innerHTML =
'Ocultar';}else{this.parentNode.getElementsByTagName('div')[0].style.display
= 'none'; this.innerHTML = 'Mostrar';}return false"
type="button">Mostrar</a><div style="display: none;">Contenido a ocultar</div></div>
Un ejemplo funcionando:
Mostrar
También se puede hacerlo en forma de botón, basta con usar este código:
Es algo fácil de implementar y usar y puede sernos útil en algunas ocasiones.
También se puede hacerlo en forma de botón, basta con usar este código:
<div><input value="Mostrar"
onclick="if(this.parentNode.getElementsByTagName('div')[0].style.display
!= ''){this.parentNode.getElementsByTagName('div')[0].style.display =
'';this.value =
'Ocultar';}else{this.parentNode.getElementsByTagName('div')[0].style.display
= 'none'; this.value = 'Mostrar';}" type="button" /><div
style="display: none;">Contenido a ocultar</div></div>
Aquí se ve una demostración:Es algo fácil de implementar y usar y puede sernos útil en algunas ocasiones.