/    Sign up×
Community /Pin to ProfileBookmark

EDITED FOR THE CONVENIENCE OF EVERYONE!

Sorry for my uneffective way of making this topic. I don’t know if it’s even in the right place, but I think it’s Javascript related so here it goes.

I need to know how to make a counter, not your tipical counter, like a countdown counter. Something like what you can see here:
[URL=http://www.superherohype.com/batman/]http://www.superherohype.com/batman/[/URL]

I have no clue how to make one and I’ve been searching franticly across the web. I just need to put this on my website quick because people are hasseling me for a countdown until a big event. Please help! I’m sorry if this is an easy job or a stupid question that was already answered elswhere (though I assure you I did look extensively!) but I have just run out of time. I’d apreciate any help anyone could give…

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@JonaSep 05.2004 — [font=trebuchet ms]Have you tried looking at [url=http://www.javascriptsource.com/]the JavaScript Source[/url]?[/font]
Copy linkTweet thisAlerts:
@zinger2099authorSep 05.2004 — wow I didn't think anyone was going to reply because of my very bad subject title. I can't seem to find what I'm looking for there... You sure that page will have it?
Copy linkTweet thisAlerts:
@JonaSep 05.2004 — [font=trebuchet ms]Don't use the search box, use the categorized index (look under "clocks" for example). The navigation is set horizontally at the top of the page, and this script is a common one, so I would be very suprised if they [i]didn't[/i] have it.[/font]
Copy linkTweet thisAlerts:
@zinger2099authorSep 05.2004 — well i found a thing that counts down but I can't figure it out and i have to go >_< dammit I spent the last 9 hours trying to find this damn countdown thign!

I may or may not be back tomorrow to finish what I didn't start >_<

thanks anyway though, sorry for the double post.
Copy linkTweet thisAlerts:
@vwphillipsSep 05.2004 — never made one before but this may help, seems to work

<i>
</i>
&lt;html&gt;

&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;input id=todate size=40 value=Until &gt; ToDate&lt;br&gt;
&lt;input id=UntilDate size=40 value=Until &gt; UntilDate&lt;br&gt;
&lt;br&gt;
&lt;input id=timeleft size=20 value=Until &gt; TimeLeft (milliseconds)&lt;br&gt;
&lt;input id=Syears size=20 value=Until &gt; Show years until&lt;br&gt;
&lt;input id=Sdays size=20 value=Until &gt; Show days until&lt;br&gt;
&lt;input id=Shours size=20 value=Until &gt; Show hours until&lt;br&gt;
&lt;input id=Sminutes size=20 value=Until &gt; Show minutes until&lt;br&gt;
&lt;input id=Sseconds size=20 value=Until &gt; Show seconds until&lt;br&gt;
&lt;input id=Scountdown size=25 value=Until &gt; Count Down&lt;br&gt;


&lt;script language="JavaScript" type="text/javascript"&gt;
&lt;!--
// Code does not account for leap years
//JS counts months from 0 to 11, September = 8
var ToDate=new Date(2009,08,10);
var UntilDate=new Date

var TimeLeft=ToDate-UntilDate
var seconds=1000;
var minutes=seconds*60;
var hours=minutes*60;
var days=hours*24;
var years=days*365;



document.getElementById('todate').value=ToDate;
document.getElementById('UntilDate').value=UntilDate;
document.getElementById('timeleft').value=TimeLeft;

function Until(){
var UntilDate=new Date();
var TimeLeft=ToDate-UntilDate;

YearsUntil=Math.floor(TimeLeft/years);
Balance=TimeLeft%years;
document.getElementById('Syears').value=YearsUntil;


DaysUntil=Math.floor(Balance/days);
Balance=Balance%days;
document.getElementById('Sdays').value=DaysUntil;

HoursUntil=Math.floor(Balance/hours);
Balance=Balance%hours;
document.getElementById('Shours').value=HoursUntil;

MinutesUntil=Math.floor(Balance/minutes);
Balance=Balance%minutes;
document.getElementById('Sminutes').value=MinutesUntil;

SecondsUntil=Math.floor(Balance/seconds);
document.getElementById('Sseconds').value=SecondsUntil;

document.getElementById('Scountdown').value=YearsUntil+' years '+HoursUntil+' hours '+MinutesUntil+':'+SecondsUntil+' minutes ';
}

setInterval('Until()',1000);

//--&gt;
&lt;/script&gt;

&lt;/body&gt;

&lt;/html&gt;
Copy linkTweet thisAlerts:
@zinger2099authorSep 05.2004 — thanks for the coding and all but no matter how I edit it it doesn't seem to want to work the way I want it to work. I'm trying to get a countdown that's almost identical (if not identical) to what you can see here:

[URL=http://www.superherohype.com/batman]http://www.superherohype.com/batman[/URL]


Any help would be apreciated.
Copy linkTweet thisAlerts:
@zinger2099authorSep 05.2004 — grrrr, this stupid counter wont work!!!

*tries another*
Copy linkTweet thisAlerts:
@zinger2099authorSep 05.2004 — *grumbles andtries again*
Copy linkTweet thisAlerts:
@zinger2099authorSep 05.2004 — update: no I have not sucessfully created my countdown yet. The best I've gotten was one that only counts days. I'm trying to edit it to include hours, minutes and seconds but have yet to suceed. Still hoping someone will stop by to help but remain sceptical of such a thing to happen. Still trying though.
Copy linkTweet thisAlerts:
@javaNoobieSep 06.2004 — The code [URL=http://www.webdeveloper.com/forum/showthread.php?threadid=35029]here[/URL] seems to work for you
×

Success!

Help @zinger2099 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...