TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 20, 2023, 09:48:22 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 194,243
  • Total Topics: 21,145
  • Online today: 61
  • Online ever: 3,540
  • (September 03, 2022, 01:38:54 AM)
Users Online
Users: 0
Guests: 37
Total: 37

Countdown date/clock

Started by ICE, February 26, 2006, 01:52:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ICE

I've got a nice tool that counts down to a specific date and time (even ms).
I attached it to this topic.

Its very simple, though there is a small problem which I can't fix right now.

- Unzip the archive.
- Place the entire map clock in the Forum directory.
- Open the file demo.js in the map clock and change ALL inserted directories into yours. For example: I changed everything into:

Quote
http://formule1.justice4u.nl/ (following with clock/)

- Change the date (line 121)

There is probably the problem to find. Try it out yourself. You will see the script ads 1 month extra!!!

- Upload the entire map clock to the server.
- Make with TP a new SCRIPT block.
- Insert the next text into this block:

Quote
<script type="text/javascript"src="http://formule1.justice4u.nl/clock/demo.js"></script>

View the attached file to see what result this script gives.

I hope you guys can use it, but more I hope somebody can fix the problem!

[attachment deleted by admin]

crip

Just Don't use Theme_title / or Theme_frame.. uncheck all.

ICE


IchBin

Looks like we are all just a confused bunch here... lol

I don't quite get what you are saying ICE. I only see 1 month displayed.. I think Crip thought you were talking about the block header and title because you're arrow was pointing at it. Can you explain what you mean any better? sorry...

ICE

I will do my best ICHBIN!

I will use an example for this:
Say you want to scedule the first Grand Prix Formula 1 of this year on March, 12th at exactly 12.30.
If I took a look today, February, 26th at 21.30, the clock would give me:
0000 year, 1 month, 13 days, 15 hours, 00 minutes and 00 seconds.

That 1 month is not correct, because it is only 13 days left, dont you think? That is what I mean. So my guess is, I'm doing something wrong or the counter isnt counting like he should count !! ;)

Hope you understand me this time!

Bye the way, how do you like the script so far?

ICE

O, something important to tell:

I installed the script on my board at http://formule1.justice4u.nl , and it may seem that the clock is working, but I changed the setup-date in the script to: February, 12th !!!. That's why he's showing the correct number of days now !!! (Not 1 month) I know, it aint the correct way, but it's the only way for now !

Prime_8

#6
Fixed.. i for yaz
(old coder / debugger / testing powers!) O0

i don't know why but when i  added this line ( that logicaly should not be needed) it works fine.

bad code lived here (removed see next post

I don't know why this line is needed but was meant to be a debug test i put in to check to see if logic in rest of code was ok .. and it is .. and it works with this line added..  so done.

Prolly some dumbness in not being able to have month - month < 1

Prime_8

#7
ok nother small bug ..
(still wrong  LOL ?)
seems this is needed see arrow #2

if (x26 >= x16) s = x26 - x16;
else {s = 60+x26-x16; x15 = x15+1; }
if (x25 >= x15) min = x25 - x15;
else { min = 60+x25-x15; x14 = x14+1; }
if (x24 >= x14) h = x24 - x14;
else { h = 24+x24-x14; x13 = x13+1; }
if (x23 >= x13) d = x23-x13;
else { d = GetDayCount(x11,x12) + x23-x13; x22 = x22-1; }
if (x22 >= x12) m = x22-x12-1;         <----------------------#2----------- this line
else { m = 12+x22-x12; x11 = x11+1; }
if (x22 == x12) m = 0;                     <----------------------#1----------- this line
y = x21 - x11;



arrow #1 is only to make shure no devide by zeros happen but should be logicaly ok to remove line marked by arrow #1
arrow #2 shows the -1 added.  don't know why but works for me.
i wonder if  ther is a "=" where a "==" should be  ?? hmm

ICE

Trying to make sense out of this.

So, If I read this the right way, and I believe I do, I should remove line 1.
Thats all??

Prime_8

#9
hey  ice the error is deeper .. i tested a whole range of dates .. it has to do with how you are rounding the days down ..

see that fixes the month number but  ups the  days by the value of a month .. so the rror is in that code block or the get  number of days function...

I'm on sic leave for a number of months so i'll figure it out ..LOL

ICE

Just great, but don't let the installed clock on my forum fool you! I've installed it at the date February 12Th instead of March 12Th. Just to be sure the bell will ring on the date I want it to ring.

And I am still not sure I know what you mean. However it feels kinda strange that this type of countdownclock does not work. But I'll see what you can find in the code. Many thanx!

Amay_Zing

Hey guys

I have just put in my site a Dynamicdrive.com countdown block which is a js file.  Low and behold I put a date and time in and its out by about 8 hours or so.  Whats wrong with this script???

Vinspire

#12
Is this script working ?

I would like to make it into a world cup countdown.

trigger39

I have just used this script but end up with a blank box. Obviously i'm doing something wrong can someone give me a step by step? type slowly please cos i can't read very fast ;)

G6Cad

Read the steps in the first post and you will find out whats wrong.
My first guess is that you have the wrong path set where you should change according to the info in the first post.
Or you have the wrong type of block.
Make sure you have a script block and not a php

trigger39

do i put them in the /forum directory including the demo file?

Xarcell

I've used both countup and countdpown scripts. Both work fine for me.

trigger39

Quote from: Xarcell on September 05, 2006, 02:03:52 PM
I've used both countup and countdpown scripts. Both work fine for me.

do i put them in the /forum directory including the demo file?

IchBin

If you read the instructions it says exactly that.

Quote- Place the entire map clock in the Forum directory.

trigger39

#19
That's what i've done and i just get a blank block  ???

edit...unless i actually use his code as it's written


<script type="text/javascript"src="http://formule1.justice4u.nl/clock/demo.js"></script>

then i just get a countdown clock


G6Cad

Change the url path to your own instead of his, look at the blue link text and put your own forum url there (the same you write to get to your forum

sburke930

This is the code I am using for a count down to xmas.  As far as I can tell it has an added hour but corrects itself once daylight savinges time ends.  Is there a code that will automatically correct this?

<font Size=1><center><script language="JavaScript">
TargetDate = "12/25/2006 00:00:00 AM";
BackColor = "";
ForeColor = "#476C8E";
CountActive = true;
CountStepper = -1;
DisplayFormat = "%%D%% Days, %%H%% Hrs,<br>%%M%% Mins, %%S%% Secs. <br>Until Santa comes to visit.";
FinishMessage = "<b>Merry Christmas!</b>";
</script>
<script language="JavaScript" src="http://www.pogowin.com/javascript/countdown.js"></script></center></font>

Reality12

Any update on this? It looks really cool and I'd like to use it.

If it is working, which script would be used?

tick

This is the one I use.  Put it in a scriptbox.  I got it from this thread I believe. 

<script language="JavaScript1.2">

/*
Dynamic countdown Script- Ã...  Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and TOS,
visit http://www.dynamicdrive.com
*/


function setcountdown(theyear,themonth,theday){
yr=theyear;mo=themonth;da=theday
}
//////////CONFIGURE THE COUNTDOWN SCRIPT HERE//////////////////

//STEP 1: Configure the countdown-to date, in the format year, month, day:
setcountdown(2007,06,17)

//STEP 2: Change the two text below to reflect the occasion, and message to display on that occasion, respectively
var occasion="your occasion here"
var message_on_occasion="message on the occasion!"

//STEP 3: Configure the below 5 variables to set the width, height, background color, and text style of the countdown area
var countdownwidth='360px'
var countdownheight='10px'
var countdownbgcolor='blue'
var opentags='<font face="Verdana"><center>'
var closetags='</font></center>'

//////////DO NOT EDIT PASS THIS LINE//////////////////

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var crosscount=''

function start_countdown(){
if (document.layers)
document.countdownnsmain.visibility="show"
else if (document.all||document.getElementById)
crosscount=document.getElementById&&!document.all?document.getElementById("countdownie") : countdownie
countdown()
}

if (document.all||document.getElementById)
document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span>')

window.onload=start_countdown


function countdown(){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
futurestring=montharray[mo-1]+" "+da+", "+yr
dd=Date.parse(futurestring)-Date.parse(todaystring)
dday=Math.floor(dd/(60*60*1000*24)*1)
dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
//if on day of occasion
if(dday<=0&&dhour<=0&&dmin<=0&&dsec<=1&&todayd==da){
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+message_on_occasion+closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+message_on_occasion+closetags
return
}
//if passed day of occasion
else if (dday<=-1){
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+"Occasion already passed! "+closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+"Occasion already passed! "+closetags
return
}
//else, if not yet
else{
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+occasion+closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+occasion+closetags
}
setTimeout("countdown()",1000)
}
</script>

<ilayer id="countdownnsmain" width=&{countdownwidth}; height=&{countdownheight}; bgColor=&{countdownbgcolor}; visibility=hide><layer id="countdownnssub" width=&{countdownwidth}; height=&{countdownheight}; left=0 top=0></layer></ilayer>

Reality12

Tick - That worked great! It's now being implemented in one of my boards.

Thanks!