I am trying to come up with a simple countdown time that displays the remaining time.
For example. Starting at 5 minutes and counting down to zero.
Is there any examples out there of the code?
Moderator: Neosoft Support
stevec wrote:I built a countdown timer years ago and can't find the code to it.![]()
![]()
![]()
stevec wrote:Thanks DEC.
stevec wrote:I looked on your site and didn't see how to register the npHour. Almost done for the day will check later. Thanks
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JavaScript 30 Seconds Countdown</title>
<script language="javascript">
var max_time = 30;
var cinterval;
function countdown_timer(){
// decrease timer
max_time--;
document.getElementById('countdown').innerHTML = max_time;
if(max_time == 0){
clearInterval(cinterval);
}
}
// 1,000 means 1 second.
cinterval = setInterval('countdown_timer()', 1000);
</script>
</head>
<body>
<p>Download will start in <span id="countdown">30</span> seconds.</p>
</body>
</html>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var start=new Date();
start=Date.parse(start)/1000;
var counts=30;
function CountDown(){
var now=new Date();
now=Date.parse(now)/1000;
var x=parseInt(counts-(now-start),10);
if(document.form1){document.form1.clock.value = x;}
if(x>0){
timerID=setTimeout("CountDown()", 30)
}else{
location.href="http://www.neosoftware.com/"
}
}
// End -->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',30);
-->
</script>
</HEAD>
<BODY>
</center>
<FORM NAME="form1">
You are being redirected to the NeoSoft Corp. Page in <INPUT TYPE="text" NAME="clock" SIZE="2" VALUE="10"> seconds.
</FORM>
</center>
Return to NeoBook Action Commands
Users browsing this forum: No registered users and 1 guest