Call: (209) 560-6611

JavaScript Loop Script

Date: May 21, 2012 Author: ang Category: Affordable Web Design Tutorials Tags: Comments: 0

You can create a loop in JavaScript by using the 'setInterval' statement. Here's an example of an error message that will keep popping up, every four seconds.

JavaScript loop script code snippet

This script will cause an error message window to popup every four seconds or 4000 milliseconds. Simply insert this code into any HTML web page, WordPress page, WordPress post, or Facebook Page.

 Javascript |  copy code |? 
1
<script type="text/javascript">
2
// set interval
3
var tid = setInterval(mycode, 4000);
4
function mycode() {
5
alert('It is time to take a 30 second break and Look Around!');
6
}
7
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *

Before you post, please prove you are sentient.

What is 8 times 7?

Before you post, please prove you are sentient.

what is 9 plus 7?