Tags: formularios,javascript,DOM

Sort by: Date / Title /

  1. 3 months 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>

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