Tags: formularios,javascript

Sort by: Date / Title /

  1. 1 year ago by jacinmontava
    1. <script type="text/javascript">
    2. function pulsar(e) {
    3.   tecla = (document.all) ? e.keyCode : e.which;
    4.   return (tecla != 13);
    5. }
    6. </script>
    7. <!-- -->
    8. <form action="loquesea.asp" onkeypress = "return pulsar(event)">
    9. <input type="text" />
    10. <input type="submit" />
    11. </form>
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1695"></script>
  2. 1 year ago by jacinmontava
    1. function stopRKey(evt) {
    2. var evt = (evt) ? evt : ((event) ? event : null);
    3. var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    4. if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
    5. }
    6. document.onkeypress = stopRKey;
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1694"></script>
  3. 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>
  4. sponsorised links
  5. 2 years ago by jacinmontava
    Esto lo realizan normalmente los navegadores cuando dentro de un formulario hay alguna forma estándar de hacer el submit, pero en el caso de que no queramos poner botón de submit, tendremos que ejecutar el siguiente código en el evento onkeypress de la caja. Extraido de www.sentidoweb.com
    1. <html>
    2. <head>
    3.    <title>Enviar formulario al pulsar un enlace</title>
    4. <script>
    5. function enviar_formulario(){
    6.    document.formulario1.submit()
    7. }
    8. </script>
    9. </head>
    10.  
    11. <body>
    12. <form action="pagina_destino.php" method=post name="formulario1">
    13.    <input name="nombre" onkeypress="if (event.keyCode == 13) enviar_formulario()"/>
    14. </form>
    15.  
    16. </body>
    17. </html>
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/768"></script>
  6. 2 years ago by jacinmontava
    1. <html>
    2. <head>
    3.    <title>Enviar formulario al pulsar un enlace</title>
    4. <script>
    5. function enviar_formulario(){
    6.    document.formulario1.submit()
    7. }
    8. </script>
    9. </head>
    10.  
    11. <body>
    12. <form action="pagina_destino.php" method=post name="formulario1">
    13. <input type="hidden" name="campo1" value="valor">
    14. <input type="hidden" name="campo2" value="otroValor">
    15. </form>
    16.  
    17. <a href="javascript:enviar_formulario()">Enviar formulario</a>
    18. </body>
    19. </html>
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/767"></script>
  7. 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 (6 posteets)