Tags: formularios,validacion

Sort by: Date / Title /

  1. 1 year ago by jacinmontava
    1. <html>
    2. <body>
    3.  
    4. <form id="myForm">
    5. Firstname: <input id="fname" type="text" value="Mickey" />
    6. Lastname: <input id="lname" type="text" value="Mouse" />
    7. <input id="sub" type="button" value="Submit" />
    8. </form>
    9.  
    10. <p>Get the value of all the elements in the form:<br />
    11. <script type="text/javascript">
    12. var x=document.getElementById("myForm");
    13. for (var i=0;i<x.length;i++)
    14.   {
    15.   document.write(x.elements[i].value);
    16.   document.write("<br />");
    17.   }
    18. </script>
    19. </p>
    20.  
    21. </body>
    22. </html>
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1297"></script>
  2. 2 years ago by jacinmontava
    1. function nif_valido(campo)
    2. {
    3. abc=campo.value
    4. nif=abc.substring(0,abc.length-1)
    5. let=abc.charAt(abc.length-1)
    6. if (!isNaN(let))
    7.  {
    8.   alert('El nif debe tener 8 digitos y una letra al final ')
    9.   campo.focus()
    10.   return false
    11.  }
    12. else
    13.  {
    14.   cadena="TRWAGMYFPDXBNJZSQVHLCKET"
    15.   posicion = nif % 23
    16.   letra = cadena.substring(posicion,posicion+1)
    17.   if (letra!=let.toUpperCase())
    18.    {
    19.     alert("NIF incorrecto.Revise la letra y no deje espacios. ")
    20.     campo.focus()
    21.     return false
    22.    }
    23.  }
    24.  
    25. return(true)
    26.  
    27. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/681"></script>

First / Previous / Next / Last / Page 1 of 1 (2 posteets)