STATEMENT:  For

for ([initial-expression]; [condition]; [increment-expression])
{statements}

The for statement creates a loop consisting of three optional expressions enclosed in brackets and seperated by semicolons, and a block of statements to be executed. The first expression is used to initialise a counter variable, the second (optional) provides a condition that is evaluated on each pass through the loop, and the third updates or increments the counter variable.

This example simply counts up from zero for as long as the counter is less than 10:

Code:
for(i=0; i<10; i++)
   document.write(i + ".<BR>");

Copyright 2000 by Infinite Software Solutions, Inc.
Trademark Information