For loop with alert dialog : For : Language Basics : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP


JavaScript DHTML  »  Language Basics   » [  For  ]   
 



For loop with alert dialog

Please note that some example is only working under IE or Firefox.

/*
Javascript Essentials
by Jason J. Manger

Publisher: Mcgraw-Hill Osborne Media; 

ISBN: 0078822343
*/

<!--
  Program 3-15
-->
<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>


           
       
Related examples in the same category
1.  For loop for lines
2.   Drawing a Christmas Tree Using Nested For Loops
3.  For loop
4.  Using a for..in Loop in JavaScript
5.  A Demonstration of a Nested Loop
6.  A for Loop Used to Count from 0 to 99
7.  Using the label Statement
8.  Using the continue and break Statements
9.  Use of the for Statement
10.  The break Statement
11.  The continue Statement
12.  Labeled Statements
13.  Plain for loop
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.