<html> <head> <script type="text/javascript"> function showFormElements(theForm) { str="Form Elements: " for (i=0; i<theForm.length; i++) str+=" \n " + theForm.elements[i].name alert(str) } </script> </head> <body> <form> First name: <input type="text" name="fname" size="20"> <br /> Last name: <input type="text" name="lname" size="20"> <br /><br /> <input type="button" name="button1" value="Display name of form elements" onClick="showFormElements(this.form)"> </form> </body> </html>
Edit the text above, and click on the button to see the result.
Copyright © 2007-2008, Www.JavaBasics.We.Bs All rights reserved.