--------------------------------------------------- | Date: 2002-09-14 01:15:27 | | Filename: for.js | | Author: mind@metalshell.com | | | | http://www.metalshell.com/ | --------------------------------------------------- <!-- for.js - mind (mind@metalshell.com) --> <!-- this shows a basic example of how to use --> <!-- the for statement in javascripting --> <!-- http://www.metalshell.com --> <!-- put this code into the <head> section of your html document. --> <!-- start our javascript --> <script language=JavaScript> // define our variable i var i; // define max as an integer of 10 var max = 10; // define message a string with: This is our.. var message = "This is our message to be printed"; // create our function function printText() { // for (initial; condition; increment) { statements; } // start our for loop for (i = 0; i < max; i++) // print the below with each loop document.write('<font>' + message + '</font><br>'); } // to do a never ending for loop use: for (;;) // end of our javascript </script> <!-- place this code anywhere on your html document (example) --> <!-- align our link below --> <div align=center> <!-- make a link that points to our js function printText() --> <a href="javascript: printText();">Click Here!</a> </div>