Advertisement
Javi

html5: forms

Mar 17th, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head></head>
  4. <body>
  5. <nav>
  6. <ol class="menu">
  7. <li>Navegación 1</li>
  8. <li>Navegación 2</li>
  9. <li>Navegación 3</li>
  10. <li>Navegación 4</li>
  11. </ol>
  12. </nav>
  13. <hgroup>
  14. <h1>Formularios</h1>
  15. <h2>html5 power</h2>
  16. </hgroup>
  17. <p>Lorem ipsum dolor sit amet, hola mundo vestrum appellas fortunae civitatem auri in fuerat est se ad quia ad te in deinde cupis hominem armatis exanimem scientiam pervenisset afferte Apollonius ut sua etiam esse in fuerat accidens quam aniculae morsque nutricem rex</p>
  18.  
  19. <form action="ok.html">
  20. Obligatario:
  21. <input name="campoObligatorio"
  22. type="text"/>
  23. <br/>
  24. Email:
  25. <input type="text" name="correo"
  26. />
  27. <br/>
  28. Teléfono:
  29. <input type="text" />
  30. <br/>
  31. Número:
  32. <input type="text" />
  33. <br/>
  34. Meter:
  35. 50 sobre 100
  36. <br/>
  37. Progress:
  38. Cargando...
  39. <br/>
  40.  
  41. Search:
  42. <input type="text" />
  43.  
  44. <input type="submit" name="aceptar"
  45. value="Aceptar" />
  46.  
  47. <input type="submit" name="cancelar"
  48. value="cancelar" />
  49.  
  50. <input type="button" name="checkCorreo"
  51. value="Comprobar Correo"
  52. />
  53.  
  54. </form>
  55.  
  56. <script>
  57.  
  58. document.forms[0].onsubmit = function() {
  59. var validacion = this.correo.validity;
  60.  
  61. var mensaje = '';
  62. for (key in validacion) {
  63. if (validacion.hasOwnProperty(key) == true) {
  64. mensaje += key + ':' + validacion[key]
  65. +'\n'
  66. }
  67. }
  68. window.alert(mensaje);
  69. return false;
  70.  
  71. return true;
  72. }
  73.  
  74. </script>
  75.  
  76. </body>
  77. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement