Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. function limpiar() {
  2. 3 document.form.reset(); //limpiamos todo el formulario
  3. 4 document.form.nom.focus(); //el cursor se posiciona en el input nom
  4. 5 }
  5. 6
  6. 7 function validar() {
  7. 8 var form = document.form; // guardamos en la variable form document.form
  8. 9 if (form.nom.value==0) {
  9. 10 alert("Ingrese su Nombre");
  10. 11 form.nom.value=""; //Nos limpia el formulario nom
  11. 12 form.nom.focus(); //Posiciona el cursor en el formulario nombre
  12. 13 return false; //para que detenga el script
  13. 14 }
  14. 15
  15. 16 if (form.texto.value==0) {
  16. 17 alert("Inserte algun Texto");
  17. 18 form.texto.value=""; //limpiamos el textarea
  18. 19 form.texto.focus(); //posicionamos el cursor a texto
  19. 20 return false; // detenga el script
  20. 21 }
  21. 22 form.submit(); //Activamos el boton de escribir
  22. 23 }
  23. 24
  24. 25 //Funcion para crear el efecto en las filas de la tabla
  25. 26 function tr(id,color) {
  26. 27 document.getElementById(id).style.backgroundColor=color;
  27. 28 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement