SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Countdown in JS?
-
Jun 30, 2002, 17:50 #1
- Join Date
- Jun 2002
- Location
- Huntsville Alabama
- Posts
- 394
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Countdown in JS?
How do you make a countdown in JS? like it counts down 5 4 3 2 1 0 in a form field. it's for a page redirect. so when the page loads it says:
you will be redirected in "number" seconds
i'm stumped so i hope somebody can help![ metabahn ] : changing the course of the web.
-
Jun 30, 2002, 18:44 #2
Try search hotscripts.com. Something like was definetely made by someone already.
-
Jun 30, 2002, 19:01 #3
- Join Date
- Mar 2002
- Location
- Svíþjóð
- Posts
- 4,080
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Something like this?
function countdown(s)
{
mySpan.innerText = s + ' seconds left...';
//mySpan = <span id="mySpan"></span> somewhere in the document
s--;
setTimeout('countdown('+s+')', 1000);
if(s <= 0) //do whatever you want to do...
}
Bookmarks