Countdown help.
Hey guys I need help making this countdown work. Im only getting this....
Im using the Edson Hilios countdown, but don't know how to set the countdown time....
jquery.countdown :
* jQuery The Final Countdown plugin v1.0.0 beta
* http://github.com/hilios/jquery.countdown
* Copyright (c) 2011 Edson Hilios
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(function($) {
$.fn.countdown = function(toDate, callback) {
var handlers = ['seconds', 'minutes', 'hours', 'days', 'weeks', 'daysLeft'];
function delegate(scope, method) {
return function() { return method.call(scope) }
return this.each(function() {
// Convert
if(!(toDate instanceof Date)) {
if(String(toDate).match(/^[0-9]*$/)) {
toDate = new Date(toDate);
} else if( toDate.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})\s([0-9]{1,2})\:([0-9]{2})\:([0-9]{ 2})/) ||
toDate.match(/([0-9]{2,4})\/([0-9]{1,2})\/([0-9]{1,2})\s([0-9]{1,2})\:([0-9]{2})\:([0-9]{ 2})/)
toDate = new Date(toDate);
} else if(toDate.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})/) ||
toDate.match(/([0-9]{2,4})\/([0-9]{1,2})\/([0-9]{1,2})/)
toDate = new Date(toDate)
} else {
throw new Error("Doesn't seen to be a valid date object or string")
var $this = $(this),
values = {},
lasting = {},
interval = $this.data('countdownInterval'),
currentDate = new Date(),
secondsLeft = Math.floor((toDate.valueOf() - currentDate.valueOf()) / 1000);
function triggerEvents() {
secondsLeft--;
if(secondsLeft < 0) {
secondsLeft = 0;
lasting = {
seconds : secondsLeft % 60,
minutes : Math.floor(secondsLeft / 60) % 60,
hours : Math.floor(secondsLeft / 60 / 60) % 24,
days : Math.floor(secondsLeft / 60 / 60 / 24),
weeks : Math.floor(secondsLeft / 60 / 60 / 24 / 7),
daysLeft: Math.floor(secondsLeft / 60 / 60 / 24) % 7
for(var i=0; i<handlers.length; i++) {
var eventName = handlers[i];
if(values[eventName] != lasting[eventName]) {
values[eventName] = lasting[eventName];
dispatchEvent(eventName);
if(secondsLeft == 0) {
stop();
dispatchEvent('finished');
triggerEvents();
function dispatchEvent(eventName) {
var event = $.Event(eventName);
event.date = new Date(new Date().valueOf() + secondsLeft);
event.value = values[eventName] || "0";
event.toDate = toDate;
event.lasting = lasting;
switch(eventName) {
case "seconds":
case "minutes":
case "hours":
event.value = event.value < 10 ? '0'+event.value.toString() : event.value.toString();
break;
default:
if(event.value) {
event.value = event.value.toString();
break;
callback.call($this, event);
/*$this.bind('remove', function() {
stop(); // If the selector is removed clear the interval for memory sake!
dispatchEvent('removed');
function stop() {
clearInterval(interval);
function start() {
$this.data('countdownInterval', setInterval(delegate($this, triggerEvents), 1000));
interval = $this.data('countdownInterval');
if(interval) stop();
start();
// Wrap the remove method to trigger an event when called
var removeEvent = new $.Event('remove'),
removeFunction = $.fn.remove;
/*$.fn.remove = function() {
$(this).trigger(removeEvent);
return removeFunction.apply(this, arguments);
})(jQuery);
index.html :
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Nero-Hosting Updating</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!-- Custom font from Google Web Fonts -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet">
<!-- Social font -->
<link href="css/social-font.css" rel="stylesheet">
<!-- Template stylesheet -->
<link href="css/metronome.css" rel="stylesheet">
</head>
<body>
<div class="container">
<!-- Header -->
<h1 class="header section">Nero-Hosting</h1>
<!-- /Header -->
<!-- Description -->
<p class="description section">We are just updating our website and making lots and lots of changes! Check Back Soon!</p>
<!-- /Description -->
<!-- Countdown -->
<div id="countdown" class="countdown section">
<div class="countdown-item">
<div class="countdown-label">Days</div>
<div class="countdown-number red" id="countdown-days">
<div class="countdown-number-side countdown-number-back"></div>
<div class="countdown-number-side countdown-number-front"></div>
</div>
</div>
<div class="countdown-item">
<div class="countdown-label">Hours</div>
<div class="countdown-number yellow" id="countdown-hours">
<div class="countdown-number-side countdown-number-back"></div>
<div class="countdown-number-side countdown-number-front"></div>
</div>
</div>
<div class="countdown-item">
<div class="countdown-label">Minutes</div>
<div class="countdown-number blue" id="countdown-minutes">
<div class="countdown-number-side countdown-number-back"></div>
<div class="countdown-number-side countdown-number-front"></div>
</div>
</div>
<div class="countdown-item">
<div class="countdown-label">Seconds</div>
<div class="countdown-number green" id="countdown-seconds">
<div class="countdown-number-side countdown-number-back"></div>
<div class="countdown-number-side countdown-number-front"></div>
</div>
</div>
</div>
<!-- /Countdown -->
<!-- Social links -->
<div class="social-links">
<a href="https://twitter.com/Nero_Hosting" class="icon-twitter-alt red"></a>
</div>
<!-- /Social links -->
</div>
<!-- Scripts -->
<script src="../ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.9.1.min.js"><\/script>')</script>
<script src="js/jquery.countdown.js"></script>
<script src="js/placeholders.min.js"></script>
<script src="js/metronome.js"></script>
<audio loop="" autoplay="">
<source src="http://www.goodymusic.it/public/allegati/audio/51823_11820913007504706977.mp3" type="audio/mpeg"></audio>
</body>
</html>
metrome design :
========================================================================================== ==============================
Metronome - Coming Soon Page
v 1.0, 13 May 2013
by Alex Shnayder
========================================================================================== ==============================
Main javascript file
$(document).ready(function() {
var config;
$.getJSON('config.json').done(function(data) {
config = data;
Countdown
========================================================================================== ========*/
var date = new Date(config.countdown.year,
config.countdown.month - 1,
config.countdown.day,
config.countdown.hour,
config.countdown.minute,
config.countdown.second),
$countdown = $('#countdown'),
$countdown_numbers = {
days: $('#countdown-days'),
hours: $('#countdown-hours'),
minutes: $('#countdown-minutes'),
seconds: $('#countdown-seconds')
tab_focused = true;
$(window).on('focus', function() {
tab_focused = true;
$(window).on('blur', function() {
tab_focused = false;
$.each($countdown_numbers, function() {
var $this = $(this);
$this.data({
angle: 0,
sides: {
current: $('.countdown-number-front', $this),
other: $('.countdown-number-back', $this)
current_side: 1
$countdown.countdown(date, function(event) {
if (event.type == 'finished') {
$countdown.hide();
} else if (tab_focused) {
var $tile,
$current_side,
$other_side,
angle,
timer;
$tile = $countdown_numbers[event.type];
if (!$tile) {
return;
$current_side = $tile.data('sides').current;
$other_side = $tile.data('sides').other;
angle = $tile.data('angle') + 180;
$tile.css('transform', 'rotateY(' + angle + 'deg)').data('angle', angle);
$other_side.text(event.value);
timer = setTimeout(function() {
$current_side.hide();
$other_side.show();
$tile.data('sides', {
current: $other_side,
other: $current_side
clearTimeout(timer);
}, 250);
Subscription form
========================================================================================== ========*/
var messages = config.subscription_form_tooltips,
error = false,
$form = $('#subscription-form'),
$email = $('#subscription-email'),
$button = $('#subscription-submit'),
$tooltip;
function renderTooltip(type, message) {
var offset;
if (!$tooltip) {
$tooltip = $('<p id="subscription-tooltip" class="subscription-tooltip"></p>').appendTo($form);
if (type == 'success') {
$tooltip.removeClass('error').addClass('success');
} else {
$tooltip.removeClass('success').addClass('error');
$tooltip.text(message).fadeTo(0, 0);
offset = $tooltip.outerWidth() / 2;
$tooltip.css('margin-left', -offset).animate({top: '100%'}, 200).dequeue().fadeTo(200, 1);
function hideTooltip() {
if ($tooltip) {
$tooltip.animate({top: '120%'}, 200).dequeue().fadeTo(100, 0);
function changeFormState(type, message) {
$email.removeClass('success error');
if (type == 'normal') {
hideTooltip();
} else {
renderTooltip(type, message);
$email.addClass(type);
$form.submit(function(event) {
event.preventDefault();
var email = $email.val();
if (email.length == 0) {
changeFormState('error', messages['empty_email']);
} else {
$.post('./admin/index.php?page=subscribe', {
'email': email,
'ajax': 1
}, function(data) {
if (data.status == 'success') {
changeFormState('success', messages['success']);
} else {
switch(data.error) {
case 'empty_email':
case 'invalid_email':
case 'already_subscribed':
changeFormState('error', messages[data.error]);
break;
default:
changeFormState('error', messages['default_error'])
break;
}, 'json');
// Remove tooltip on text change
$email.on('change focus click keydown', function() {
if ($email.val().length > 0) {
changeFormState('normal');
============================================================
If you need more info or files just tell me...
Read the documentation:
http://hilios.github.io/jQuery.countdown/
Nancy O.
Similar Messages
-
Month/Year reverse countdown help needed
I need to create a simple reverse countdown that only needs
the detail level of Months and Years. All of the tutorials I've
found online are for counting down smaller intervals of time, like
days, minutes, seconds, and milliseconds.
I'm not very experienced with the code needed for such a
timer, but essentially what I would like to have happen is:
1. The current Month and Year are displayed onscreen.
2. I click the mouse, and the Month and Year begin to count
BACKWARDS, as if going back in time, so the Year would go from
2007, to 2006, to 2005, etc, while the 12 months of the year would
count down in reverse to coincide with the Year.
3. When I click the mouse again, the countdown stops at
whatever month/year it happens to be, I assume all the way back to
the Year 0 if I let it play to the end.
BONUS points if this reverse countdown could speed up over
time, so that it appears to begin slowly, and rapidly speed up as
the timer goes further back in time.
Note that I do not need to use the ACTUAL date taken from the
computer's clock, I'd be happy to just enter in, say "June 2007" as
the start date and have it reverse from there. So even something
that would just countdown from the numeral "2007" to "0" while a
movieclip of the 12 months cycling along could work, though I have
no concept as to how to control/increase the speed of such an
animation as it plays.put the months in an array "december" to "january", and set a
variable equal to the start year and an index that corresponds to
the start month. display the start year/month.
start a loop (setTimout would work) with a variable call
frequency that calls a function that
1. increases your array index (decreasing the year and
restarting your index at 0 after the last array element is
displayed) and displays the updated month/year
2. decreases the variable call frequency and define another
setTimeout. -
Ok, i want my code to countdown to a specific time within my
date.
What do i have to add to enable it to do this?
ThanksHello!
All you do is set the hour, minute and second properties of
your target date object!
var targetDate:Date = new Date(2007,5,4, 9, 30, 54); // Wed
June 4 09:30:54 GMT+0200 2007
And your code will work ;)
However i recomend you look in to using some other means of
updating the displayed time. onEnterFrame might do it too offen
making this metod a bit unpractical. Seeing how we only display the
seconds you might only need an interval timer set to 100 ms. -
A weird 'person sitting at a laptop ' icon pops up suspending the use of my Mac. I see a countdown for 3 minutes and a line of letters to type in to allow me to continue working. I have 2 minutes to work. Help. What is this!
Hate to say it. I isolated this to only be happening with email/Mail program. Then ran Sophos Virus detector on it and it did show a trojan virus in my email spam folder. I eliminated it ; ran disk utility a couple of times and I am good now. Spent the whole day on it though before I thought of using a virus scan... as soon as I started running sophos it stopped sending me the two minute timer as well--so just opening the virus software was able to disengage whatever was happening. My computer is all mac --no PC interface added at all. Hope that was that. Thank you for responding.
-
Need help with adjusting Javascript code to work in Adobe Edge (Countdown)
Hello
Im a newbie when it comes to working with Javascript and Adobe Edge and need a bit of help with adjusting some javascript code to work with Adobe Edge. A friend of mine helped me with making this javascript code: Edit fiddle - JSFiddle
Its a simple countdown which counts down to a certain time at a certain date. What I aim to do is to add this code as a trigger on a text-element called "countdown" (within a symbol called "count").
I have tried to do this as the code is, but it does not work. Anyone have any suggestions?
Thanks!
Mvh,
Øyvind HermansHello again
I have stumbled upon a problem with these animations; They crash the browser after viewing them a little while, usually less than 30 seconds in.
Is this problem also occuring when you watch the animations?
Is the countdown-code to much for the browsers to handle?
Thanks in advance for your answers.
Sincerely,
Øyvind Hermans -
Need help on countdown timer!
Could someone please guide me in the direction as to how to make a countdown timer? I created a timer that counts down to a certain date, but I just want the timer to countdown 24 hours, not to a certain date. I also want to have a button below the timer so that when you click it, it adds 30 seconds to the timer. Can anyone help me with this?
Hi,
I hope it will be use full for u....
var timelong=2000;
var mytimer:Timer=new Timer(timelong,1);
mytimer.addEventListener(TimerEvent.TIMER_COMPLETE,myfunc);
mytimer.start();
function myfunc(event:TimerEvent)
trace("hi it's working");
mybut.addEventListener(MouseEvent.CLICK,addtime);
function addtime(event:MouseEvent)
timelong+=3000;
Thanks,
K Swamy Vishnubhatla, -
Help me about AS3 code of 24 hour countdown timer.
Hi,
I'm a beginner at flash.
i just wanna ask about making 24hours countdown clock.
what i want is to make it only 24hour countdown clock and when it reaches the time it will start again.(every day)
and The start time is 2 o'clok(2 pm) every single day.(for the pacific time)
and I found this code from (http://forums.adobe.com/message/4116774 )
It's similar with what i want but even I tried, I can't change for mind...
and I want using hundredths too.
so here is the code.
Please help me,Thank you.
var endDate:Date = new Date(new Date().getTime()+24*60*60*1000);
var countdownTimer:Timer = new Timer(1000);
countdownTimer.addEventListener(TimerEvent.TIMER, updateTime);
countdownTimer.start();
function updateTime(e:TimerEvent):void
var now:Date = new Date();
if(now.getTime()>endDate.getTime()){
time_txt.text = "00:00:00";
countdownTimer.stop();
return
var timeLeft:Number = endDate.getTime() - now.getTime();
var hundredth:Number = Math.floor(timeLeft / 10);
var seconds:Number = Math.floor(hundredth / 1000);
var minutes:Number = Math.floor(seconds / 60);
var hours:Number = Math.floor(minutes / 60);
seconds %= 60;
minutes %= 60;
var fs:String = hundredth.toString();
var sec:String = seconds.toString();
var min:String = minutes.toString();
var hrs:String = hours.toString();
if (fs.length < 2) {
sec = "0" + fs;
if (sec.length < 2) {
sec = "0" + sec;
if (min.length < 2) {
min = "0" + min;
if (hrs.length < 2) {
hrs = "0" + hrs;
var time:String = hrs + ":" + min + ":" + sec;
time_txt.text = time;Thank U , and so sorry I have problem.,..
It Just stop and It was not start again..........What should I do?
because I wanna auto play every single day.
It should be end at 2pm,and then the countdown starts again for next day.
var endDate:Date = new Date();
endDate.setHours(14);
endDate.setMinutes(0);
endDate.setSeconds(0);
endDate.setMilliseconds(0);
var countdownTimer:Timer = new Timer(10);
countdownTimer.addEventListener(TimerEvent.TIMER, updateTime);
countdownTimer.start();
function updateTime(e:TimerEvent):void
var now:Date = new Date();
if(now.getTime()>endDate.getTime()){
time_txt.text = "00:00:00:00";
countdownTimer.stop();
return
var timeLeft:Number = endDate.getTime() - now.getTime();
var milliseconds:Number = Math.floor(timeLeft /10);
var seconds:Number = Math.floor(milliseconds / 100);
var minutes:Number = Math.floor(seconds / 60);
var hours:Number = Math.floor(minutes / 60);
milliseconds %= 100;
seconds %= 60;
minutes %= 60;
var mil:String = milliseconds.toString();
var sec:String = seconds.toString();
var min:String = minutes.toString();
var hrs:String = hours.toString();
if (mil.length < 2) {
mil = "0" + mil;
if (sec.length < 2) {
sec = "0" + sec;
if (min.length < 2) {
min = "0" + min;
if (hrs.length < 2) {
hrs = "0" + hrs;
var time:String = hrs + ":" + min + ":" + sec + ":" + mil;
time_txt.text = time; -
Helping making countdown in Motion 3
Hello I am trying to make a new years countdown in motion 3. I tried using the Templete "Clockwork" from motion library and set the timing to 1:00 in the inspector. The problem is after 10 seconds the template disappears. Also what is the best way to Make numbers countdown in motion from 60-1? Do I have to set a new for each second in motion? Any help would be appreciated
I see so if I do a 60 second countdown I will have to have 60 text tracks.
That seems like a lot for a project like this..is there a easier faster way?
It's only "a lot" if you don't need the control and fun of controlling the elements. You can build a timecode countdown in FCP, export it, and mask out everything except the numbers you want. You can use After Effects. Or, as noted, you can purchase third party filters or use Flash. Motion's a difficult application to grasp for your first hundred projects.
bogiesan -
hey everyone, this is pretty much my first time using
ActionScript and I am having a couple of problems that im hoping
someone could help me with. Im trying to make a file that will
basically countdown from 4 minutes to zero displaying minutes,
seconds, and milliseconds. They way that i went about doing it
(which may be way more complicated than i need) was to get the
current date and then add four minutes to it. It would then
countdown from that point. The more i think about it though, the
more that i realize that this is basically a loop in which every
time it runs through it will get the new current date and then add
4 minutes to that, so it would never be counting down. Im not
really sure if that is what is happening and what the solution to
it would be. Here is the code that I have been working with, thanks
for all your help in advance!Here's a countdown script that I found somewhere online. You
should be able to manipulate it to do what you want (change the
hundredths to thousandths) unless it is fine as is (using
hundredths). Note that in this code as soon as it reaches the zero
count, it advances to frame 2 to exit the enterFrame looping. Since
your new to AS, you oughta study it and see how to adapt it to the
way you approached it... you may find you weren't too far off (I
haven't looked into your code specifically). -
I am designing a 30 minutes countdown timer with a LDR in the circuit.
So far i can`t even achieve a simple countup timer from 0-9 , please help.
Clock pulse (Astable multivibrator)- 555 timer circuit
4 bit counter wired as MOD 10 74LS293N
74LS47N Decoder
LED common anode.
Attachments:
Simple countup 0-9 counter.ms10 128 KBIt seems that your 555 timer isn't counting, I hooked up an oscilloscope to it to see what it was generating
Attachments:
Simple countup 0-9 counter.ms11 353 KB -
Hello Everyone, I am very very new to flash cs5, a friend told me to try out the trial for it so i did and now that i've got the program i'm wondering is there anyway for me to create a Screensaver countdown clock with it? I'm looking forward to Transformers 3 lol And I would like to have a countdown clock of that. It comes out July 1st 2011. So what i would like to know is: Is there a tutorial or something that would show me how step by step how to create something like that or someone on here that could teach me how to.
Any help is appreciated
FishlargeHi.
If you want a simple countdown clock and you don't want to learn
the language to produce it yourself, then try http://www.gieson.com/Library/projects/utilities/countdown/
There are lots of freely available flash countdown clocks out there..
Just google "Free flash countdown counter" (without the quotes).
Most have a description about the usage...
Best regards
Peter -
Help in AS3 code of 24 hour countdown timer
hello,
i just wanna ask if someone can help me,
i created a 24 hour flash countdown timer here http://allofmyworks.weebly.com/flash.html
the problem is when it reaches the desired time, the time still counts and became negative,
what i want is to make it only 24hour countdown clock and when it reaches the time it will only stay in 00:00:00
thanks
here is the code i used
var endDate:Date = new Date(2012,0,4);
var countdownTimer:Timer = new Timer(1000);
countdownTimer.addEventListener(TimerEvent.TIMER, updateTime);
countdownTimer.start();
function updateTime(e:TimerEvent):void
var now:Date = new Date();
var timeLeft:Number = endDate.getTime() - now.getTime();
var seconds:Number = Math.floor(timeLeft / 1000);
var minutes:Number = Math.floor(seconds / 60);
var hours:Number = Math.floor(minutes / 60);
seconds %= 60;
minutes %= 60;
var sec:String = seconds.toString();
var min:String = minutes.toString();
var hrs:String = hours.toString();
if (sec.length < 2) {
sec = "0" + sec;
if (min.length < 2) {
min = "0" + min;
if (hrs.length < 2) {
hrs = "0" + hrs;
var time:String = hrs + ":" + min + ":" + sec;
time_txt.text = time;here is the code
var endDate:Date = new Date(new Date().getTime()+24*60*60*1000);
var countdownTimer:Timer = new Timer(1000);
countdownTimer.addEventListener(TimerEvent.TIMER, updateTime);
countdownTimer.start();
function updateTime(e:TimerEvent):void
var now:Date = new Date();
var timeLeft:Number = endDate.getTime() - now.getTime();
var seconds:Number = Math.floor(timeLeft / 1000);
var minutes:Number = Math.floor(seconds / 60);
var hours:Number = Math.floor(minutes / 60);
seconds %= 60;
minutes %= 60;
var sec:String = seconds.toString();
var min:String = minutes.toString();
var hrs:String = hours.toString();
if (sec.length < 2) {
sec = "0" + sec;
if (min.length < 2) {
min = "0" + min;
if (hrs.length < 2) {
hrs = "0" + hrs;
var time:String = hrs + ":" + min + ":" + sec;
time_txt.text = time; -
Help needed in creatin a countdown
I am creating a banner ad that has a date on it and that date
needs to change from 1987,1988,1989...to 2007. It is using a
specific font for the numberes and i need to keep the file siaze
down. I am guessing this can be done with actionscript but I am not
clear on how to do this. please helpThe Child Text parameter is the one you are searching for. It accepts a 1D string array for the following columns.
hope this helps,
Norbert
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it. -
Countdown to christmas ActionScripting help
I'm trying to make a countdown clock and was following a tutorial online. Heres the link.
http://www.youtube.com/watch?v=XrTHOUqaS-o&feature=related
Good news! I have the clock working and it is counting down to Sunday like his. But I need it to countdown to christmas and I dont know enough about coding. I tried targetDate but since the coding wasnt setup for it, it didnt work. So any ideas would be great.
stop();
var countdownTimer:Timer = new Timer(1000);
countdownTimer.addEventListener(TimerEvent.TIMER, updateTimer);
countdownTimer.start();
function updateTimer(Event:TimerEvent):void{
var today:Date = new Date();
var year = today.getFullYear();
var dtsBegin:Date = new Date(year, 2, 13);
var dtsEnd:Date = new Date(year, 10, 6);
if((today >= dtsBegin) && (today <= dtsEnd)){
today.minutes -= 240;
else{
today.minutes -= 300;
today.minutes += (today.getTimezoneOffset());
var sunday = 0;
var s:int = 59 - today.seconds;
var m:int = 59 - today.minutes;
var h:int = 0 - today.hours;
var d:int = sunday - today.day;
if(s < 0){
s += 60;
m--;
if(m < 0){
m += 60;
h--;
if(h < 0){
h += 24;
d--;
if(d < 0){
d += 7;
var days:String = new String(d);
var hours:String = new String(h);
var minutes:String = new String(m);
var seconds:String = new String(s);
if(days.length < 2) days = "0" + days;
if(hours.length < 2) hours = "0" + hours;
if(minutes.length < 2) minutes = "0" + minutes;
if(seconds.length < 2) seconds = "0" + seconds;
var time:String = days + ":" + hours + ":" + minutes + ":" + seconds;
time_txt.text = time;
if(s + m + h + d <= 0){
countdownTimer.stop();
gotoAndPlay(2);use:
stop();
var countdownTimer:Timer = new Timer(1000);
countdownTimer.addEventListener(TimerEvent.TIMER, updateTimer);
countdownTimer.start();
function updateTimer(Event:TimerEvent):void{
var today:Date = new Date();
var year = today.getFullYear();
var dtsBegin:Date = new Date(year, 2, 13);
var dtsEnd:Date = new Date(year, 11, 25);
if((today >= dtsBegin) && (today <= dtsEnd)){
today.minutes -= 240;
else{
today.minutes -= 300;
today.minutes += (today.getTimezoneOffset());
var sunday = 0;
var s:int = 59 - today.seconds;
var m:int = 59 - today.minutes;
var h:int = 0 - today.hours;
var d:int = sunday - today.day;
if(s < 0){
s += 60;
m--;
if(m < 0){
m += 60;
h--;
if(h < 0){
h += 24;
d--;
if(d < 0){
d += 7;
var days:String = new String(d);
var hours:String = new String(h);
var minutes:String = new String(m);
var seconds:String = new String(s);
if(days.length < 2) days = "0" + days;
if(hours.length < 2) hours = "0" + hours;
if(minutes.length < 2) minutes = "0" + minutes;
if(seconds.length < 2) seconds = "0" + seconds;
var time:String = days + ":" + hours + ":" + minutes + ":" + seconds;
time_txt.text = time;
if(s + m + h + d <= 0){
countdownTimer.stop();
gotoAndPlay(2); -
I got this countdown timer, when a date is passed in, it shows days, hours, minutes, seconds, milliseconds. One problem, is that the hours contain the days converted into hours and any other hours less the 24, minutes contain all the minutes of the days, hours and any other minutes left over etc. (I know hard its to understand). Wondering if anyone out there knew how to stop this (looking for the days, and hours left over, NOT day converted to hours and hours left over less than a day), i think i need to use mod(%), but i dont know where. Here come the code, run it, it works perfectly and you will see what I mean. Code solution would be gravy
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
mDate = new Date("15:54 April 29 2004")
function countdown()
var now=new Date()
var diff=mDate.getTime()-now.getTime()
if (diff <= 0)
document.bid.mseconds.value = 0
return 0;
document.bid.days.value = Math.round(diff/(24*60*60*1000))
document.bid.hours.value = Math.round(diff/(60*60*1000))
document.bid.minutes.value = Math.round(diff/(60*1000))
document.bid.seconds.value = Math.round(diff/1000)
document.bid.mseconds.value = diff
var id=setTimeout("countdown()",0)
</SCRIPT>
</HEAD>
<BODY onLoad="countdown()">
Countdown <BR>
<form name="bid" method="post" action="">
<p>Timeleft</p>
<TABLE BORDER=0>
<TD width="79">Days: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="days" SIZE=15></TD> <TR>
<TD width="79">Hours: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="hours" SIZE=15></TD> <TR>
<TD width="79">Minutes:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="minutes" SIZE=15></TD> <TR>
<TD width="79">Seconds: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="seconds" SIZE=15></TD> <TR>
<TD width="79">Milliseconds:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="mseconds" SIZE=15></TD> <TR>
</TABLE>
</form>
</BODY>
</HTML>
Regards,
Don Colvin (Computer Science Student)and what is your JSP related question ?
Maybe you are looking for
-
How do I transfer photos from iPad to flashdrive
How do I transfer photos from iPad to a flash drive?
-
Hi All, We are having some trouble with HTTP sessions. Sometimes our browser will have a session cookie set but will be issued a new session cookie anyways. This seems to occur only one in every 10 attempts, and seems to occur more frequent
-
Hello, I'm looking for an enhancement or exit or Badi for this transaction but I can't find anything. Could you help me? Thanks
-
CF Card Detection - how to turn off?
How do I stop lightroom from autodetecting a CF card placed into a camera or reader and starting up? Cheers :)
-
Follow-up Irecruitment Questions...
I copied the Irecruitment External Candidate Responsibility to xxIrecruitment External Candidate Responsibility. Now I want to make that responsibility as a default when somebody for outside register in the Irec site. The IRC: Registration Business G