Ver Mensaje Individual
  #9 (permalink)  
Antiguo 20/12/2011, 15:36
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: Ocultar varias capas cuando hago clic en el enlace de abrir

Cita:
Iniciado por UsuarioArroba Ver Mensaje
Aunque reitero que con la solución de Isabel tengo suficiente. Saludos.
ese código deberías de intentar hacerlo mas dinámico

por ejemplo
Cita:
<html>
<head>
<title></title>
<script type="text/javascript">
function abrircategoria(val) {
var seleccion = val.split('#')[1];
for(var i = 1, elem = document.getElementsByTagName('div'); i < elem.length; i++) {
document.getElementById(elem[i].id).style.display = (seleccion == elem[i].id) ? 'block' : 'none';
}
}
</script>
<style type="text/css">
div#categoria1, div#categoria2{
width: 200px;
top: 0;
left:0;
margin-top: 8px;
margin-left: 8px;
padding: 0;
background-color: #8B8B42;
display: none;
}
</style>
</head>
<body>
<div id="categorias">
<a href="#categoria1" onclick="abrircategoria(this.href); return false;">Abrir Categoria 1</a>
<a href="#categoria2" onclick="abrircategoria(this.href); return false;">Abrir Categoria 2</a>
</div>
<div id="categoria1">
<a href="#" onclick="this.parentNode.style.display='none'; return false;">Cerrar Categoria 1</a>
</div>
<div id="categoria2">
<a href="#" onclick="this.parentNode.style.display='none'; return false;">Cerrar Categoria 2</a>
</div>
</body>
</html>
__________________
if(ViolenciaDeGénero) {alert('MUJER ASESINADA');}

Última edición por IsaBelM; 20/12/2011 a las 16:07