Countdown Problems

Problems with forum installation, administration, moderation and other phpBB related support.

Moderator: Moderators

Countdown Problems

Postby PhilAdminCLTS on Wed Mar 11, 2009 12:53 pm

Hi,

my name's Philipp, I'm the administrator of a forum of a few football fans (http://clts09.foren-city.at) and I've got a question concerning countdowns. (Actually, I'm Austrian and English's not my first language, but I'm trying my very best so that everyone can understand what I want - I'm begging for mercy for grammatical mistakes :) )

I wanted to open a new thread, a new space in the forum where a countdown (days, hours, minutes, seconds) til the next match should be displayed. But I'm a pure rookie in programming and coding and so on, I never did something like that before. :?
So, what I need is help.

I actually found a good example of what I finally expect. As far as I know this is javascript (even though I've got absolutely no idea, if there's a difference). I just want to integrate something like that into my forum, but I don't know how to do so that it works in the end.

Please, help! :cry:


That's the example I've meant:

<script language="javascript">
/* *********** USAGE *********
### Author.......: Andreas Burger
### email........: sirsiggi@bin-ich-jesus.de
### Last Change..: 06.03.2004

#################################
### Free to use for everyone! ###
#################################

To use the Script, you only have to set the date you are looking forward to
in the variable "todate" (second Line after this Comment).

Possible prints are:
Weeks, Days, Hours, Minutes, Seconds

The placeholder for each print has to be an HTML object like: <span>,<div>,<p> etc...
with the id="weeks" bzw. "days" bzw. "hours" bzw. "minutes" bzw. "seconds".

Also you can set the descriptions for each print by Setting the *text vars in the
lines after the date.

Have fun!

*/

var actualdate = new Date();
var todate = new Date(2004,08,01,12,12,12);

var weektext = " Wochen, ";
var daytext = " Tage, ";
var hourtext = " Stunden, ";
var minutetext = " Minuten, ";
var secondtext = " Sekunden.";

var seconds, minutes, hours, days, weeks;
var sh_seconds, sh_minutes, sh_hours, sh_days, sh_weeks;
var remain;

function Countdown() {

actualdate = new Date();
difference = todate - actualdate;
seconds = difference / 1000;

sh_weeks = Math.floor(seconds / 60 / 60 / 24 / 7);
remain = seconds - (sh_weeks * 7 * 24 * 60 * 60);
sh_days = Math.floor(remain / 60 / 60 / 24);
remain = remain - (sh_days * 24 * 60 * 60);
sh_hours = Math.floor(remain / 60 / 60);
remain = remain - (sh_hours * 60 * 60);
sh_minutes = Math.floor(remain / 60);
remain = remain - (sh_minutes * 60);
sh_seconds = Math.floor(remain);

if (document.getElementById('weeks')) { document.getElementById('weeks').innerHTML = sh_weeks + weektext; }
if (document.getElementById('days')) { document.getElementById('days').innerHTML = sh_days + daytext; }
if (document.getElementById('hours')) { document.getElementById('hours').innerHTML = sh_hours + hourtext; }
if (document.getElementById('minutes')) { document.getElementById('minutes').innerHTML = sh_minutes + minutetext; }
if (document.getElementById('seconds')) { document.getElementById('seconds').innerHTML = sh_seconds + secondtext; }
}

function init() {

setInterval("Countdown()",1000);
Countdown();
}

init();

</script>



<span id="weeks"></span>
<span id="days"></span>
<span id="hours"></span>
<span id="minutes"></span>
<span id="seconds"></span>
PhilAdminCLTS
Registered User
Registered User
 
Posts: 2
Joined: Wed Mar 11, 2009 11:24 am

Return to phpBB Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron