Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/04/2012, 15:09
Avatar de roal40
roal40
 
Fecha de Ingreso: enero-2012
Mensajes: 61
Antigüedad: 12 años, 3 meses
Puntos: 4
Ocultar div al pinchar fuera de el

Buenas, he hecho un apartado de notificaciones, en el que al darle, con un onclick, se vuelve un display:block y se muestran las notificaciones, pero para cerrarlo o le das al icono de nuevo o no se cierra... me gustaria que al dar fuera del div, en cualquier otro sitio, se cerrase...

Código HTML:
<a href="javascript:void(0)" id="mostrarnotificacion" onClick="document.getElementById('notificaciones').style.display = ' block ';document.getElementById('mostrarnotificacion').style.display = ' none ';document.getElementById('ocultarnotificacion').style.display = ' block ';document.getElementById('left_arrow_notificaciones').style.display = ' block ';">
    <div class="notification"></div>
    <div class="titulo"><p>Alertas</p></div>
    </a>
    <a href="javascript:void(0)" id="ocultarnotificacion" onClick="document.getElementById('notificaciones').style.display = ' none ';document.getElementById('mostrarnotificacion').style.display = ' block ';document.getElementById('ocultarnotificacion').style.display = ' none ';document.getElementById('left_arrow_notificaciones').style.display = ' none ';">
    <div class="notification"></div>
    <div class="titulo"><p>Alertas</p></div>
    </a>