For loop with alert dialog
<html> <head> <script language="JavaScript"> <!-- function seeElem(f) { var elementList = ""; for (var num=0; num < f.elements.length; num++) { elementList += num + ". " + f.elements[num] + "\n"; } alert(elementList); } //--> </script> </head> <body> <form> <table> <tr> <td>Name:</td> <td><input name="persname" type="text"> </tr> <tr> <td>E-mail:</td> <td><input name="email" type="text"></td> </tr> </table> <input type="button" value="See elements" onClick="seeElem(this.form)"> </form> </body> </html>