Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   How To Create A countdown (https://www.warriorforum.com/programming/594402-how-create-countdown.html)

Dennisknows 6th May 2012 01:35 PM

How To Create A countdown
 
Can someone please show me how to create a simple countdown for one of my landing pages...

What I'm trying to do is make a number like 102.3 (seconds.milliseconds) countdown to zero. I want it to start over for every visitor.

Just looking for regular text.. Nothing fancy..

I've been trying to find this script for a long time now (on and off a year) but can't come across what I need; not even with Google..

If it's some type of secret industry script, please email me about it..

I greatly appreciate it..

Brandon Tanner 6th May 2012 02:30 PM

Re: How To Create A countdown
 
What you're looking for is a Javascript countdown timer. If you Google it you'll find tons of choices and code examples.

FYI, a tenth of a second (as in your example) is called a decisecond. A millisecond would be like 102.3000, which would be extremely processor-intensive to count down and would probably crash most (if not all) of your visitor's browsers.

I would just use seconds if I were you. Any greater resolution than that, and you start risking potential browser/display issues with your visitors who are on slower connections.

Dennisknows 6th May 2012 02:59 PM

Re: How To Create A countdown
 
Learn something new everyday. I've done tons of searches but I don't think I searched for that exactly..

Thanks Brandon..

I'll get on it...

dbwebdesignz 6th May 2012 05:08 PM

Re: How To Create A countdown
 
Javascript can do this, it will reset every time a user refreshes the page though

johndoejohndoe 6th May 2012 05:34 PM

Re: How To Create A countdown
 
Quote:

Originally Posted by dbwebhosting (Post 6196269)
Javascript can do this, it will reset every time a user refreshes the page though

I'm not sure if it's useful to OP either way, but it doesn't have restart every visit if you know how to use the javascript cookies plugin. ;)

Dennisknows 6th May 2012 08:10 PM

Re: How To Create A countdown
 
Quote:

Originally Posted by johndoejohndoe (Post 6196398)
I'm not sure if it's useful to OP either way, but it doesn't have restart every visit if you know how to use the javascript cookies plugin. ;)

I don't know anything about Javascript.. This is the dilemma I've been dealing with off and on for close to a year now...

It's been like a bad relationship; only if I get this one right, it will make me money instead of take it away... :D

I've found tons of scripts on timers and I can do those but all of them have to the date in them and i don't know enough about Javascript to edit it...

I'm starting to get the feeling that the javascript countdown I'm looking for in particular costs a lot of money.... :eek:

Brandon Tanner 6th May 2012 08:43 PM

Re: How To Create A countdown
 
Dennis, check this out... it counts down by seconds only...

Countdown to extra profits -- Ask Michel Komarov

Dennisknows 6th May 2012 08:44 PM

How does Javascript work?
 
Am I suppose to paste the countdown javascript code in a FILENAME.js file and then paste the "src=site.com/FILENAME.js" in the PHP coding?

or

can I just paste it in my PHP coding?

Dennisknows 6th May 2012 08:59 PM

Re: How To Create A countdown
 
Quote:

Originally Posted by Brandon Tanner (Post 6197068)
Dennis, check this out... it counts down by seconds only...

Countdown to extra profits -- Ask Michel Komarov

Brandon my man that was it.. Took me a minute of playing around with it but I got it working.. Now Im going to tweak it a bit..

I'm saving that script to my evernote so I can have it available at all times..

Thanks again man.. You really helped me out a lot with that..

Brandon Tanner 6th May 2012 09:39 PM

Re: How To Create A countdown
 
No worries... glad I could help!

lordspace 7th May 2012 10:53 PM

Re: How To Create A countdown
 
Hi Dennis,

have you checked this: jQuery Plugin: jQuery Countdown

webpeon 8th May 2012 06:29 PM

Re: How To Create A countdown
 
Quote:

Originally Posted by Brandon Tanner (Post 6195592)
FYI, a tenth of a second (as in your example) is called a decisecond.

Looks like I learnt something new today, its interesting I just learnt the other day that "jiffy" is actually a measurement as well, not just the slang ive always thought it to be.

TheApex 9th May 2012 02:52 AM

Re: How To Create A countdown
 
Hello,

I made a small javascript snippet, that may do what you want... or at least what I understand you want :)
However it may "force" the browser a bit, but it should be fine.

HTML Code:

<script>
milliseconds = 200 * 1000;  //countdown length

first = new Date().getTime();   
function start_cd()
{
    now = new Date().getTime() - first;
    document.getElementById('timer').innerHTML = Math.round((milliseconds - now)/1000*1000)/1000;
   
    if (milliseconds - now > 0)
            setTimeout("start_cd()", 1);

   
}
</script>

<body onLoad="start_cd();">
<div id="timer">
</div>
</body>


brandonthomas 11th May 2012 07:11 AM

Re: How To Create A countdown
 
In order to create a countdown timer in JavaScript you'll have to use the window.setTimeout function which will call a JavaScript function after a certain amount of time.

System Wide Solutions 11th May 2012 08:37 PM

Re: How To Create A countdown
 
Javascript count doen is the best solution. you can create very attractive ones.

ivankristianto 13th May 2012 05:58 AM

Re: How To Create A countdown
 
Give me your email, then i can email you my wordpress plugin for countdown.

Dennisknows 13th May 2012 09:11 AM

Re: How To Create A countdown
 
Quote:

Originally Posted by ivankristianto (Post 6234274)
Give me your email, then i can email you my wordpress plugin for countdown.

Ok.. Sending you a pm and a friend request now.. Thanks

Quote:

Originally Posted by System Wide Solutions (Post 6227594)
Javascript count doen is the best solution. you can create very attractive ones.

I guess I need to study JavaScript because I see that it is very valuable to Internet marketing. What's a good way to get started in learning JavaScript if anyone knows any

Brandon Tanner 13th May 2012 10:56 AM

Re: How To Create A countdown
 
Quote:

Originally Posted by Dennisknows (Post 6234936)
I guess I need to study JavaScript because I see that it is very valuable to Internet marketing. What's a good way to get started in learning JavaScript if anyone knows any

Yeah... Javascript is pretty cool. Just keep in mind that a small percentage (~ 1-2%) of your website visitors will have JS disabled in their browser, so you don't want to rely on JS for anything that is "mission critical". But for all other uses, it's fine.

That said, I think Tizag has excellent tutorials for beginners...

Javascript Tutorial - Intro

W3Schools also has good tutorials...

JavaScript Tutorial

ivankristianto 15th May 2012 01:55 AM

Re: How To Create A countdown
 
Hi Dennis,
since i cannot send pm (because my post is not 50 yet).
can you send me your email instead?
i will send it to your email.

Quote:

Originally Posted by Dennisknows (Post 6234936)
Ok.. Sending you a pm and a friend request now.. Thanks



I guess I need to study JavaScript because I see that it is very valuable to Internet marketing. What's a good way to get started in learning JavaScript if anyone knows any


shantanu 15th May 2012 02:28 PM

Re: How To Create A countdown
 
Easy way to get rid of this **** >> MAKE YOUR OWN COUNTER

Alternative Solution To This Problem

designdon 15th May 2012 07:12 PM

Re: How To Create A countdown
 
You can either use flash or php to make count down, according to me flash countdown is better

jewelraz 16th May 2012 06:48 AM

Re: How To Create A countdown
 
I will try with this keyword "Javascript countdown timer", I was also thinking about it.... I might need it if I move my site to another server.

thesilvershield 21st July 2012 06:15 AM

Re: How To Create A countdown
 
Quote:

Originally Posted by Brandon Tanner (Post 6197068)
Dennis, check this out... it counts down by seconds only...

Countdown to extra profits -- Ask Michel Komarov

I've been looking for such a countdown timer the whole day! Thanks a lot! The post you linked definitely solved my problem too!

xbluelinks 21st July 2012 06:53 AM

Re: How To Create A countdown
 
If you are using Wordpress, you may want to consider using Wordpress Countdown Plugins.

Here are a few good ones:

jaasmit 22nd July 2012 05:10 AM

Re: How To Create A countdown
 
To create a countdown on your landing page then you have to do it with javascript and to do that you need to have proper knowledge and skill about programming language.

oknoorap 24th July 2012 09:27 AM

Re: How To Create A countdown
 
do you familiar with jQuery framework?, if you familiar then PM me (sorry but, I can't sit down everyday in front of my laptop)

antac 25th July 2012 12:38 PM

Re: How To Create A countdown
 
Can you put PHP or java on your site? If you can use java then try that. It should be real easy to make one that is constantly ticking down. Also, you can probably make one in flash. I know for a fact you could do one in PHP but it wouldn't tick down constantly, only when the page was refreshed. Try searching google for a premade one.

WebdevelopmentGroup 25th July 2012 08:40 PM

Re: How To Create A countdown
 
Are you looking for something like this:

LaunchSoon Demo

mmrumii 26th July 2012 01:53 AM

Re: How To Create A countdown
 
Here i have shared a link where you can find your solution.
you can create countdown by using javascript.

http://www.google.com/url?sa=t&rct=j...hObk6vsTfjky0w

ubaid12j 27th July 2012 03:18 AM

Re: How To Create A countdown
 
Use the following code.

Code:

<script language="JavaScript">

//Refresh page script- By Brett Taylor (glutnix@yahoo.com.au)
//Modified by Dynamic Drive for NS4, NS6+
//Visit http://www.dynamicdrive.com for this script

//configure refresh interval (in seconds)
var countDownInterval=60;
//configure width of displayed text, in px (applicable only in NS4)
var c_reloadwidth=200

</script>


<ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer>

<script>

var countDownTime=countDownInterval+1;
function countDown(){
countDownTime--;
if (countDownTime <=0){
countDownTime=countDownInterval;
clearTimeout(counter)
window.location.reload()
return
}
if (document.all) //if IE 4+
document.all.countDownText.innerText = countDownTime+" ";
else if (document.getElementById) //else if NS6+
document.getElementById("countDownText").innerHTML=countDownTime+" "
else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN
document.c_reload.document.c_reload2.document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
document.c_reload.document.c_reload2.document.close()
}
counter=setTimeout("countDown()", 1000);
}

function startit(){
if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN
document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
countDown()
}

if (document.all||document.getElementById)
startit()
else
window.onload=startit

</script>


markmotts 14th August 2012 02:48 AM

Re: How To Create A countdown
 
Hey Gang - Do you know of a countdown timer solution that will work within a WSO post?

Brandon Tanner 14th August 2012 08:20 AM

Re: How To Create A countdown
 
Quote:

Originally Posted by markmotts (Post 6792011)
Hey Gang - Do you know of a countdown timer solution that will work within a WSO post?

Not possible, as you can't insert (working) HTML or Javascript into WF posts.

Liviu Ungureanu 21st December 2012 09:07 AM

Re: How To Create A countdown
 
Quote:

Originally Posted by Brandon Tanner (Post 6197068)
Dennis, check this out... it counts down by seconds only...

Countdown to extra profits -- Ask Michel Komarov

Thanks a lot for this !!


All times are GMT -6. The time now is 10:13 PM.