Home
 
 
Search:  
C C++ Perl PHP Python HTML ShellScripts
 
 
  Coding Books
  Tutorials
  Search Code
  Browse Code
  Link to Us
  Site News
  Contact Metalshell
 
 
 
  Submit Code   Statistics
 



Teach Yourself Visually HTML    (ISBN: 0764534238)


 

 List Price: $29.99
 Our Price: $20.99
 Used Price: $7.29

 Release Date: October, 1999
 Manufacturer: John Wiley & Sons (Paperback)
 Sales Rank: 35,772

 Author: Ruth Maran









More Info

 Javascript For Loop 2002-09-14 01:15:27
  html 
Category: source:html:javascript
Description: Example on how to use the for loop in javascript.
Platform: all
Author: mind
Viewed: 56582
Rating: 3.5/5 (91 votes)
If you have any questions about this piece of code or still need help, try posting your question on the forum.

 

Printable Version
for.js
<!-- 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>
Rate this code:
(Not Helpful)  (Very Helpful) 

 
 
   Developer.*  
   Blue Parrots  
   Technipal  
   Defy Magazine  
   Code Project  
   Prog. Heaven  


Got Money?