Solved

Countdown clock that resets automatically?

Posted on 2006-11-07
4
370 Views
Last Modified: 2009-12-16
I want to add a javascript clock to my web page that counts down DAILY from 8:00 until 17:00 EST... It should display the current date and time and the time left until 17:00...

Ex: November 7, 2007 11:35 EST ------- 5 Hours, 25 minutes remaining until ....

I can find scripts on the web that already do this. However, this repeats EACH day Monday thru Friday from 8:00 until 17:00... So at 8:00 the following day, the counter should reset and begin another cycle...

Ideally, I would want this to be automatic so I didn't have to change the ending date each day...

Any ideas on how I should proceed?
0
Comment
Question by:bfhiii
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 17893548
<script language="javascript">
function NeedCntDown() {
var dt = new Date();
// Sunday = 0, Saturday = 6
// Do counter on Monday and Fridays
if (dt.getDay() == 1 || dt.getDay() == 5) {
   //
   // Your script goes here.
  //
}
</script>
0
 
LVL 23

Accepted Solution

by:
rama_krishna580 earned 250 total points
ID: 17903919
Hi,

<head>
<script LANGUAGE="JavaScript">
<!--
// Javascript Countdown
// Version 1.0 1/20/2000
// by TDavid at http://www.tdscripts.com/
var now = new Date();
var event = new Date("Sep 29 2001 00:00:01");
var seconds = (event - now) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
var days = hours / 24;
ID=window.setTimeout("update();", 1000);
function update() {
now = new Date();
seconds = (event - now) / 1000;
seconds = Math.round(seconds);
minutes = seconds / 60;
minutes = Math.round(minutes);
hours = minutes / 60;
hours = Math.round(hours);
days = hours / 24;
days = Math.round(days);
document.form1.days.value = days;
document.form1.hours.value = hours;
document.form1.minutes.value = minutes;
document.form1.seconds.value = seconds;
ID=window.setTimeout("update();",1000);
}
// --></script>
</head>
<body>

<p><font face="Arial" size="3">Countdown To September 29, 2001, at 12:00: </font></p>
<form name="form1"><p>Days <input type="text" name="days" value="0" size="3"> Hours
<input type="text" name="hours" value="0" size="4"> Minutes <input type="text" name="minutes" value="0"
size="7"> Seconds <input type="text" name="seconds" value="0" size="7"> </p>
</form>

</body>
</html>

http://www.tdscripts.com/jscountdown.html

R.K
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question