Tutorials

Learn web design and programming with our free video and text tutorials.

Free Web Tools

Advertisements

Contact us if you would like to advertise here.

Web Designer? Design and market your own professional website with easy-to-use tools.

Browse our HTML, XHTML and CSS tutorials to learn how to create your website at LearnWebsiteDesign.com or download one of our free website templates.

Advertise your text link and description here.

Providing high quality free software to download

Javascript for Loops Tutorial

Javascript allows you to use loops to execute the same block of code a specified number of times while a condition is true.

In javascript there are two different kind of loops: for loops and while loops.

The javascript code below shows you the for loop in action.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>WebDevelopmentTutorials.com</title>

</head>
<body>

<script type="text/javascript" language="javascript">

for (count=1; counter<=10; count++)
document.write("I can count to " + count + "<br />");

</script>

</body>
</html>

The javascript code above displays: