/    Sign up×
Community /Pin to ProfileBookmark

help white script

Hey i found this script.

function startTimeUp(timeleft,counter)
{
if(timeleft > 0)
{
timeleft = parseInt(timeleft)+1;

var min_count = timeleft/60;
min_count = Math.floor(min_count);

if(min_count > 0)
{
var std_count = min_count/60;
std_count = Math.floor(std_count);
min_count = min_count-(std_count*60);
}
else{
var std_count = 0;
}

if(std_count > 24)
{
var day_count = std_count/24;
day_count = Math.floor(day_count);
std_count = std_count-(day_count*24);
}
else{
var day_count = 0;
}

if(min_count < 10)
{
var min_angabe = ‘0’+min_count;
}
else{
var min_angabe = min_count;
}

document.getElementById(“counter”+counter).innerHTML = std_count+”:”+min_angabe;
window.setTimeout(“startTimeUp(‘”+timeleft+”‘,'”+counter+”‘);”,1000);

}
else
{
document.getElementById(“counter”+counter).innerHTML = “”;
}

}

<script language=”JavaScript” type=”text/javascript” src=”/js/countdown.js”></script>
<span id=’counterCurrentTime’></span>
<script language=”javascript” type=”text/javascript”>startTimeUp(‘xxx’,’CurrentTime’);</script>

Only i cant find out with what i have to replace the xxx ?
in this line
<script language=”javascript” type=”text/javascript”>startTimeUp(‘xxx’,’CurrentTime’);</script>

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@msikkemaauthorMar 30.2009 — any one
Copy linkTweet thisAlerts:
@haulinMar 30.2009 — looks like some countdown script, but it actually counts up ?

you should replace the "xxx" with number of seconds you want to start the countdown with (no apostrophes needed). if you want to see seconds left as well (not only minutes and higher units), edit the code like this:
[CODE]
function startTimeUp(timeleft,counter)
{
if(timeleft > 0)
{
timeleft = parseInt(timeleft)+1; [B]//timeleft = parseInt(timeleft)-1; will count down[/B]

var min_count = timeleft/60;
min_count = Math.floor(min_count);


if(min_count > 0)
{
var std_count = min_count/60;
std_count = Math.floor(std_count);
min_count = min_count-(std_count*60);
}
else{
var std_count = 0;
}

if(std_count > 24)
{
var day_count = std_count/24;
day_count = Math.floor(day_count);
std_count = std_count-(day_count*24);
}
else{
var day_count = 0;
}

if(min_count < 10)
{
var min_angabe = '0'+min_count;
}
else{
var min_angabe = min_count;
}

document.getElementById("counter"+counter).innerHTML = std_count+":"+min_angabe[B]+":"+((timeleft%60<10)?"0":"")+timeleft%60[/B];
window.setTimeout("startTimeUp('"+timeleft+"','"+counter+"');",1000);

}
else
{
document.getElementById("counter"+counter).innerHTML = "";
}
}
[/CODE]

enjoy ?
Copy linkTweet thisAlerts:
@msikkemaauthorMar 31.2009 — Thanks, i have found it.

its a day timer or how you call it.

its shows the current server time.

at this to the page.

<?php

$now=time();

$endday=mktime(0, 0, 0, date("m"), date("d"), date("Y"));

$time=$now-$endday;

?>

replace the "xxx" whit $time like this:

<script language="javascript" type="text/javascript">startTimeUp('<? echo $time ?>','CurrentTime');</script>


But thank haulin for you reaction
×

Success!

Help @msikkema 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.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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