Recursive timer by using setTimeout

We need to execute a function or code block at a fixed interval to carry out some routine work. Here we need a triggering function which will start the required function at a definite time gap. To do this we will use our setTimeout function. setTimeout JavaScript built in function we will use inside a user defined function and we will call the same function within it to make it recursive. We will be using one alert to display a message at every interval.

Here is the demo of recursive timer

Here is the code.


<script type="text/javascript">

function disp(){

function timer(){


<body onLoad="timer();">


Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here .

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer