Get form element infomation : Form Info « Form Control « JavaScript DHTML






Get form element infomation

 <html> <head> <script language="JavaScript"> <!-- function showElements(f) { var formElements = ""; for (var n=0; n < f.elements.length; n++) { formElements += n + ":" + f.elements[n] + "\n"; } alert("The elements in the form '" + f.name + "' are:\n\n" + formElements); } //--> </script> </head> <body> <form name="ExampleForm"> <table border=0> <tr> <td> <input name="cb1" type="checkbox" checked>Option 1<br> <input name="cb2" type="checkbox">Option 2 </td> </tr> <tr> <td>Name:</td> <td><input type="text" size=45 name="fullname"></td> </tr> <tr> <td>Address:</td> <td><textarea name="ta"></textarea></td> </tr> <tr> <td> <input type="button" value="See elements" onClick="showElements(this.form)"> </td> </tr> </form> </table> </body> </html> 








Related examples in the same category

1.Formats, verifies and recover the contents of HTML forms
2.Count forms in a document
3.Access an item in a collection
close