For loop with alert dialog : For : Language Basics JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Language Basics » For »

 

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>


           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Language Basics
» For