dsr95

html js lab 2

Feb 10th, 2015
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4.  
  5. <title>DSRLab2</title>
  6.  
  7. <script type="text/javascript">
  8. function validacion()
  9. { //open function
  10. var nombre
  11. var apellido
  12. var correo
  13. var pueblo
  14. var pais
  15. var edad
  16. var pasatiempos
  17.  
  18.  
  19. nombre = document.form1.txtnombre.value;
  20. apellido = document.form1.txtapellido.value;
  21. correo = document.form1.txtcorreo.value;
  22. pueblo = document.form1.txtpueblo.value;
  23. pais = document.form1.txtpais.value;
  24. edad = 0;
  25. pasatiempos = 0;
  26.  
  27.  
  28.  
  29.  
  30. if (nombre < 1)
  31. {
  32. alert("Por favor ingrese su nombre.");
  33. }
  34. else if (apellido < 1)
  35. {
  36. alert("Por favor ingrese su apellido.");
  37. }
  38. else if (correo < 1)
  39. {
  40. alert("Por favor ingrese su correo electronico.");
  41. }
  42. else if (pueblo < 1)
  43. {
  44. alert("Por favor ingrese su pueblo de residencia");
  45. }
  46. else if (pais < 1)
  47. {
  48. alert("Por favor ingrese su pais de residencia");
  49. }
  50.  
  51. for(i=0; i < form1.rango.length; i++)
  52. { //begin FOR radio
  53. if (form1.rango[i].checked)
  54. {
  55. edad = 1
  56. }
  57.  
  58. }//end FOR radio
  59.  
  60. if (edad == 0)
  61. {
  62. alert("Por favor indique su rango de edad");
  63. }
  64.  
  65. if(!document.form1.cine.checked)
  66. {
  67. alert("Por favor ingrese un pasatiempo");
  68. }
  69.  
  70. if(!document.form1.musica.checked)
  71. {
  72. alert("Por favor ingrese un pasatiempo");
  73. }
  74.  
  75. if(!document.form1.videojuegos.checked)
  76. {
  77. alert("Por favor ingrese un pasatiempo");
  78. }
  79.  
  80. if(!document.form1.playa.checked)
  81. {
  82. alert("Por favor ingrese un pasatiempo");
  83. }
  84.  
  85. if(!document.form1.ejercicios.checked)
  86. {
  87. alert("Por favor ingrese un pasatiempo");
  88. }
  89. }//end function
  90. </script>
  91.  
  92. </head>
  93.  
  94. <body bgcolor="ff99ff">
  95.  
  96. <h1>Formulario General:</h1>
  97.  
  98. <form name="form1">
  99.  
  100.  
  101. Nombre: <input type="text" name="txtnombre">
  102. <br> <br>
  103. Apellido Paterno: <input type="text" name="txtapellido">
  104. <br> <br>
  105. Correo Electronico: <input type="text" name="txtcorreo">
  106. <br> <br>
  107. Pueblo: <input type="text" name="txtpueblo"> Pais: <input type="text" name="txtpais">
  108. <br> <br>
  109. Rango de edad: <br>
  110. <input type="radio" name="rango" value="menor de 20">Menor de 20
  111. <br>
  112. <input type="radio" name="rango" value="20 - 40">20 - 40
  113. <br>
  114. <input type="radio" name="rango" value="40 - 60">40 - 60
  115. <br>
  116. <input type="radio" name="rango" value="60 o mas">60 o mas
  117. <br> <br>
  118.  
  119.  
  120.  
  121.  
  122. Pasatiempo favoritos
  123. <br>
  124. <input type="checkbox" name="cine">Cine
  125. <br>
  126. <input type="checkbox" name="musica">Musica
  127. <br>
  128. <input type="checkbox" name="videojuegos">Video Juegos
  129. <br>
  130. <input type="checkbox" name="playa">Playa
  131. <br>
  132. <input type="checkbox" name="ejercicios">Ejercicios
  133. <br> <br>
  134.  
  135. <table>
  136. <th>
  137. Escriba su opinion sobre su programa de estudios:
  138. </th>
  139. <td>
  140. <textarea rows="4" cols="50">
  141. </textarea>
  142. </td>
  143. <th>
  144. Sugerencias:
  145. <th>
  146. <td>
  147.  
  148. <textarea rows="4" cols="50">
  149. </textarea>
  150. </td>
  151. </table>
  152. <br>
  153. &iquest;Cuantas horas navega en internet diariamente? (Aproximado)
  154. <br>
  155. <br>
  156.  
  157. <select>
  158. <option value="1 hora">1 hora</option>
  159. <option value="2 horas">2 horas</option>
  160. <option value="3 horas">3 horas</option>
  161. <option value="4 horas">4 horas</option>
  162. <option value="5 horas">5 horas</option>
  163. <option value="6 horas">6 horas</option>
  164. <option value="7 horas">7 horas</option>
  165. <option value="8 horas">8 horas</option>
  166. <option value="9 horas">9 horas</option>
  167. <option value="10 horas">10 horas</option>
  168. </select>
  169.  
  170. <br>
  171. <br>
  172. <input type="submit" name="enviar" value="Enviar Formulario" onclick="validacion()">
  173.  
  174. <input type="submit" name="borrar" value="Borrar Formulario">
  175.  
  176.  
  177. </body>
  178.  
  179. </html>
Advertisement
Add Comment
Please, Sign In to add comment