Recent Articles
- SEO Friendly Drop Down Menu Using JQuery, Started by shabbir in HTML/DHTML - JavaScript/VBScript
- Footer SlideUp For Any Website and Any AutoResponder, Started by shabbir in HTML/DHTML - JavaScript/VBScript
- How to Load Advertisements Asynchronously, Started by shabbir in HTML/DHTML - JavaScript/VBScript
- How to Have Double Color Border Elements?, Started by shabbir in HTML/DHTML - JavaScript/VBScript
- VB Script to Compare Two Excel Files with Multiple Tabs, Started by naimish in HTML/DHTML - JavaScript/VBScript
Similar Articles
- Auto Suggest with Javascript, Started by pradeep in HTML/DHTML - JavaScript/VBScript
- PHP On-The-Fly!, Started by Kings in PHP
- My Project:ShutDown Timer ver 1.0, Started by alok in MFC / Win32
Code: JavaScript
var mins,secs,TimerRunning,TimerID;
TimerRunning=false;
function Init() //call the Init function when u need to start the timer
{
mins=15;
secs=0;
StopTimer();
StartTimer();
}
function StopTimer()
{
if(TimerRunning)
clearTimeout(TimerID);
TimerRunning=false;
}
function StartTimer()
{
TimerRunning=true;
window.status="Time Remaining "+Pad(mins)+":"+Pad(secs);
TimerID=self.setTimeout("StartTimer()",1000);
Check();
if(mins==0 && secs==0)
StopTimer();
if(secs==0)
{
mins--;
secs=60;
}
secs--;
}
function Check()
{
if(mins==5 && secs==0)
alert("You have only five minutes remaining");
else if(mins==0 && secs==0)
{
alert("Your alloted time is over.");
}
}
function Pad(number) //pads the mins/secs with a 0 if its less than 10
{
if(number<10)
number=0+""+number;
return number;
}











Yet to provide details about himself

Linear Mode

