Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 10-21-2008, 06:23 AM Countdown timer
Junior Talker

Posts: 3
Trades: 0
Hi guys, i have a problem with my counter. i can get the min, sec and hour to work but not the rest. Really need some help over here. Thanks.

Code:
<html>

<script type="text/javascript">

function showtime() {

var endDate = new Date("05/14/2009");
var dateDiff= Math.floor((endDate - new Date()/1000));

var secDiff = (dateDiff/1)%60;
var minDiff = Math.floor((dateDiff/60)%60);
var hourDiff = Math.floor((dateDiff/(60*60))%24);
var dayDiff = Math.floor((dateDiff/(60*60*24))%30);
var weekDiff = Math.floor((dateDiff/(60*60*24*30))%4);
var mthDiff = Math.floor((dateDiff/(60*60*24*7*4))%12);


document.getElementById('display').innerHTML = mthDiff + " mth " + weekDiff + " week " + dayDiff + " day " +  hourDiff + " hour " + minDiff + " min " + secDiff + " Secs "  ;

setTimeout(showtime,1000);

}



</script>
<div id='display'></div>
<body onload ="showtime()"> 
</body>
</html>

Last edited by mclarensquall; 10-21-2008 at 06:27 AM..
mclarensquall is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-25-2008, 04:11 AM Re: Countdown timer
Junior Talker

Posts: 3
Trades: 0
Hi, any one knows what is wrong with my coding? Thanks.
mclarensquall is offline
Reply With Quote
View Public Profile
 
Old 10-25-2008, 05:25 AM Re: Countdown timer
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
what is is doing? or not, as the case maybe.

"not the rest" is a pretty vague description of the problem. Also what browsers have you been testing this in?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-03-2008, 12:12 AM Re: Countdown timer
Junior Talker

Posts: 3
Trades: 0
Quote:
Originally Posted by chrishirst View Post
what is is doing? or not, as the case maybe.

"not the rest" is a pretty vague description of the problem. Also what browsers have you been testing this in?
Hi, I am actually referring to the month, week and day. Tested in FF.
mclarensquall is offline
Reply With Quote
View Public Profile
 
Old 11-03-2008, 04:30 AM Re: Countdown timer
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Sure, BUT are they, not showing, showing the wrong ones, counting in reverse or something else?

BTW the #display element is in the wrong place in your code.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Countdown timer
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29873 seconds with 12 queries