The "for" statement is a popular method for doing iterative loops.
Make sure that you don't put a semicolon after the right paren:
Wrong: for (i=0; i<10; i++); { /* code goes here */ }
Right: for (i=0; i<10; i++) { /* code goes here */ }
Code:
<script type="text/javascript"> //<![CDATA[
i = 1; for (i=1; i<=10; i++) { document.write(i, "<br>"); } //]]> </script>
Output: