Ver Mensaje Individual
  #6 (permalink)  
Antiguo 02/11/2014, 02:27
Avatar de MaNuX0218
MaNuX0218
 
Fecha de Ingreso: marzo-2014
Mensajes: 787
Antigüedad: 10 años, 2 meses
Puntos: 67
Respuesta: Hacer que aparezca un div al clicar en un enlace

Devería quedarte de está manera:

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  4. <title>Documento sin t&iacute;tulo</title>
  5. <script type="text/javascript">
  6. function AbrirDiv(){
  7.     document.getByElementId("mi_div").style.display = "block";
  8.     }
  9.    
  10. function CerrarDiv(){
  11.     document.getByElementId("mi_div").style.display = "none";
  12.     }
  13.     </script>
  14. </head>
  15.  
  16. <body onClick="CerrarDiv();">
  17.  
  18. <button type="button" onclick="AbrirDiv()" >
  19. efecto
  20. <div id="mi_div" style="display:none">
  21. Hola
  22. </div>
  23.  
  24. </body>
  25. </html>

Esto aria que cuando haces clic en el boton lo muestre y si aces clic fuera se cierre.

Saludos.