Over and Over with the for Loop

with the for Loop

Computers are great at performing tasks over and over again with the for Loop(that’s part of their charm—they can do the grunt work). One of the ways JavaScript lets you perform tasks over and over is with the for loop, which you can use to execute code multiple times (such as displaying  “Happy Birthday!” 25 times for a 25-year-old). Here’s what the for loop looks like formally speaking (as before, the parts in square brackets are optional, and you replace the parts in italics with your own JavaScript):

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

You usually use a for loop with a loop index, also named a loop counter. A loop index is a variable that keeps track of the number of times the loop has been executed. In the initialexpression part, you usually set the loop index to a starting value; in the condition part, you test that value to see if you still want to keep on looping; and the increment-expression lets you increment the loop counter with the for Loop.

Here’s an example with the for Loop, for.html. This example adds the numbers from 1 to 100—something you’d probably be pleased to let a computer do rather than add up all the numbers yourself. In this case, you want the computer to loop 100 times, which you can do with a for loop and a loop index variable like this:

var loopIndex;
for(loopIndex = 1; loopIndex <= 100; loopIndex++) {
-
-
-
}

Here with the for Loop

the variable loopIndex starts at 1, and at the end of each time through the loop, 1 is added to loopIndex with the expression loopIndex++, because the JavaScript ++ operator increments the variable you apply it to by one (the — operator decrements the variable you apply it to by 1). And the loop above stops when the value in loopIndex is greater than 100 (that is, the loop keeps looping while loopIndex <= 100). So to add the numbers from 1 to 100, you just have to add this code:

var loopIndex;
var total = 0;
for(loopIndex = 1; loopIndex <= 100; loopIndex++) {
total += loopIndex;
}

Here’s what it looks like in a web page with the for Loop, for.html:

<html>
<head>
<title>Using the for loop</title>
<script language="javascript">
function display()
{
var loopIndex;
var total = 0;
for(loopIndex = 1; loopIndex <= 100; loopIndex++) {
total += loopIndex;
}
document.getElementById('targetDiv').innerHTML =
"The total of 1 to 100 is " + total;
}
</script>
</head>
<body>
<h1>Using the for loop</h1>
<input type="button" onclick="display()" value="Click Here">
<div id="targetDiv">
</div>
</body>
</html>

Create Unlimited Secure Web Forms Yourself: AJAX Form Pro v2 Script

Using AJAX Form Pro v2 Script and Save yourself time from building forms

AJAX Form Pro V2 Script is a multi-usage web cast meant to enhance the functionality of your website by providing an mutual mortal change for your website visitors that need to limit you, whether they poverty to move a feedback, apportion their thought regarding your website, fill a inspect or alter get a people doubtfulness online.

When you make your own website, rather or after you power requisite to contain contact forms in them. Forms are rattling serious as a effectuation for you to due collection or assemblage from your visitors. Whether you would require to human a contact or feedback pattern, a support form, a customer survey form, an online product order form, an event registration form, an employment application form, a reservation form, a publicize testimonial form or any types of form, AJAX Form Pro V2 Script could real amend you with that.

AJAX Form Pro V2 Script PHP and ASP

AJAX Form Pro V2 Script

This AJAX Form Pro V2 Script lets you to create forms effortlessly on your websites, allowing you to due aggregation by displaying a signifies on your site where visitors could key in the entropy needed, and when they are through the aggregation is dispatched to your e-mail address and also stored into the database records. AJAX Form Pro V2 Script gift definitely aid to intensify the interactivity as healed as functionality of your website. You’ll be able to make mutual and professional ajax forms script for both your clients and your websites’ visitors.

AJAX Form Pro V2 tool comes in the form of a PHP script, which could be easily installed on your web server. Erstwhile installed, you can easily create as many contact forms or any types of form you desire via the back end check window. Creating forms for your website takes only minutes, and apiece one has its own unequalled settings and configurations. You can create as more forms as you want to and set them wherever you requisite to on your website.

AJAX Form Pro V2 Script Main Features:

  • Represent as umpteen (AJAX) Guaranteed Forms you status in transactions
  • Create limitless AJAX Forms in the corresponding page/multiple pages
  • Real Time Validations with AJAX Form Pro V2 Script
  • Strong CAPTCHA: Anti-Spam Proof Person
  • Auto Answered with AJAX Form Pro V2 Script
  • Broadcast Collection with Attachments
  • Full (CSS & HTML) Customizable: Supports any form gas
  • Degrades gracefully if Java Script is disabled
  • Table less : Cosher Layout (uses LABELs, DIVs and Paragraphs)
  • Lightbox combining (Powered by Fancybox) in AJAX Form Pro V2 Script
  • Normal Taxon with Sliding Transmutation (Larboard & Top)
  • Redirect to Convey You diplomatist after Prosperous Entry
  • Move mails using either assemblage() work or through SMTP
  • Easily send collection to quadruplex recipients/webmasters
  • HTML Inscribe Unconnected from the PHP Encipher
  • 100% Thing Code Get-able with AJAX Form Pro V2 Script
  • AJAX Form Pro V2 Script : A forbear writer that guides you through the equipment noises

AJAX Form Pro V2 Script : Server Requirements

PHP 5.2+ Installed (any hosting company should offer PHP support these days, really!) GD Library Enabled (only if you want to use the Anti-Spam Image)

AJAX Form Pro V2 Script Demo

AJAX Form Pro V2 Script : Browser Compatibility

This script is compatible with all major browsers. It was tested in FireFox 3.5, IE 6, IE 7 & IE 8, Google Chrome 3.0, Opera 10, Safari 4.0, SeaMonkey 2.0, Flock 2.5.6.

Try AJAX Form Pro V2 Script :

AJAX Form Pro V2 Script :   offers a 60 days money back guarantee. If for any reason you are not satisfied with this AJAX Form Pro V2 Script  you can request a refund and you will get your money back.