Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/10/2012, 17:10
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: Consulta de como un icono me despliegue un formulario en DIVs

aunque el código de lubtufano funcionara. aquí te dejo otra manera de hacerlo manteniendo el checkbox y agregando una imagen

puedes hacer que sea solamente css (css3 no compatible con navegadores antiguos) con lo que quita todo el js, evento e invocación. o puedes hacerlo con js, con lo que quita el último selector css
Cita:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<style type="text/css">
#chk {
width: 0;
height: 0;
overflow: hidden;
position: absolute;
}

#chk ~ label {
display: inline-block;
}

#chk ~ label ~ div{
display: none;
}

#chk:checked ~ label ~ div{
display: block;
}
</style>

<script type="text/javascript">
function fnc(bol) {
document.getElementById('frm').style.display = (bol) ? 'none' : 'block';
}
</script>
</head>
<body>

<input type="checkbox" id="chk" onclick="fnc(this.checked)" />
<label for="chk"><img src="img1.png" style="width:25px;height:25px;" alt="" /></label>
<div id="frm">el formulario</div>

</body>
</html>
__________________
if(ViolenciaDeGénero) {alert('MUJER ASESINADA');}