TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Javascript, AJAX, E4X (http://www.talkphp.com/javascript-ajax-e4x/)
-   -   Countdown timer with php (http://www.talkphp.com/javascript-ajax-e4x/5567-countdown-timer-php.html)

KingOfTheSouth 09-07-2010 09:11 AM

Countdown timer with php
 
I have not worked a lot with javascript in the past. What I am trying to is make it count down live with javascript and php. The php statement is
PHP Code:

<?=countup($site[cron5min]+300)?>

this is what I have up now but you have to refresh the page to see that the time has gone down. I want the javascript to do it live and automatically refresh when it gets to zero because it will restart the countdown. Can anyone help me out?

EyeDentify 09-07-2010 11:31 AM

Quote:

Originally Posted by KingOfTheSouth (Post 30966)
I have not worked a lot with javascript in the past. What I am trying to is make it count down live with javascript and php. The php statement is
PHP Code:

<?=countup($site[cron5min]+300)?>

this is what I have up now but you have to refresh the page to see that the time has gone down. I want the javascript to do it live and automatically refresh when it gets to zero because it will restart the countdown. Can anyone help me out?

I will give you a push in the right direction :)

Have a look at these JavaScript object methods:

http://www.w3schools.com/jsref/met_win_setinterval.asp

And this one:

http://www.w3schools.com/jsref/met_loc_reload.asp

You should be able to figure it out now :)

Or are you using AJAX with a framework to call a PHP file somewhere and in that is the code that renders the "counter" and when that counter reaches zero it should reload ?

sidisinsane 09-07-2010 11:41 AM

I have a countdown demo at http://sidisinsane.com/playground/css-countdown/ that uses only PHP. There's a link at the bottom to view the code.

delayedinsanity 09-07-2010 04:42 PM

The jQuery Countdown plugin by Keith Wood is by far my favorite countdown script. I've used it on many sites and it's always been easily adaptable to suit my needs.


All times are GMT. The time now is 01:24 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0