
23/04/2013, 06:18
|
 | | | Fecha de Ingreso: julio-2011 Ubicación: Córdoba, España
Mensajes: 124
Antigüedad: 13 años, 8 meses Puntos: 13 | |
Respuesta: Ocultar texto, pulsar boton y mostrarlo Prueba entonces lo siguiente: en vez de usar la propiedad visibility, utiliza display:
<html>
<head>
<script>
function mostrar(enla) {
obj = document.getElementById('oculto');
obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
enla.innerHTML = (enla.innerHTML == '-') ? '+' : '-';
}
function mostrar2(enla) {
obj = document.getElementById('oculto2');
obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
enla.innerHTML = (enla.innerHTML == '-') ? '+' : '-';
}
</script>
</head>
<body>
<a href="#" onclick="mostrar(this); return false" />+</a>
<div id="oculto" style="display:none">
<p>Este texto se verá cuando yo quiera </p>
<p>Este texto se verá cuando yo quiera </p>
<p>Este texto se verá cuando yo quiera </p>
<p>Este texto se verá cuando yo quiera </p>
<p>Este texto se verá cuando yo quiera </p>
</div> <p> //para que los div no salgan en la misma línea
<a href="#" onclick="mostrar2(this); return false" />+</a>
<div id="oculto2" style="display:none"> Este texto se verá cuando yo quiera</div>
</body>
</html> |