1°._ forma de link:
<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;">AQUI LO QUE QUIERES OCULTAR</div></div>
2°._forma de boton:
<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;">INSERTA AQUI EL CONTENIDO QUE QUIERES OCULTAR</div></div>
Fuente: Trucos Geek
No hay comentarios:
Publicar un comentario