HighDots Forums  

countdownscript, probs mit stunden und tagen

Javascript (German) Programmiersprache JavaScript. (de.comp.lang.javascript)


Discuss countdownscript, probs mit stunden und tagen in the Javascript (German) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alex Coleman
 
Posts: n/a

Default countdownscript, probs mit stunden und tagen - 04-25-2007 , 08:27 AM






Tach Leude

Brauch mal eure Hilfe

Bin nit sehr gut in JC, arbeite hauptsächlich mit php und sql

In meinem aktuellen project ist ein countdownscript enthalten:



<span id=printhis></span>
<script>
var limit = "<?php echo"$varminuten : $varsekunden";?>"
if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function begintimer(){
if (!document.all&&!document.getElementById)
return
thelement=document.getElementById? document.getElementById("printhis"):
document.all.printhis
if (!document.images)
return
if (parselimit<=5)
window.self.focus()
if (parselimit==1){
location.reload()
}else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" Minute/n und "+cursec+" Sekunden "
else
curtime=cursec+" seconds "
thelement.innerHTML="<b style='font-size:12;color:;face:;'>"+curtime+"</b>"
setTimeout("begintimer()",1000)
}}window.onload=begintimer
//-->
</script>




Bis jetzt hat damit auch alles gut geklappt, allerdings zeigt dieses nur
minuten und sekunden an, ich wüsst jetzt gerne ich das umbauen kann
so das auch stunden und tage angezeigt werden.

v.G.
Alex


--
dumdidumdidum


Reply With Quote
  #2  
Old   
Raymond Czerny
 
Posts: n/a

Default Re: countdownscript, probs mit stunden und tagen - 04-26-2007 , 07:12 AM






Alex Coleman schrieb:
Quote:
Tach Leude

Brauch mal eure Hilfe

Bin nit sehr gut in JC, arbeite hauptsächlich mit php und sql

In meinem aktuellen project ist ein countdownscript enthalten:



span id=printhis></span
ändern in:


<span id=printhis>&nbsp;</span> <!-- damit ein Kindknoten existierts -->

<script type="text/javascript">

var utc = new Date();
var startutc = ( 1000 * <?php echo"$utctime";?> ); /* UTC-Zeit ( von 01.01.1970 in Sekunden )*/

function countDown()
{
var now = new Date();
var delta = ( ( startutc - now.getTime() ) / 1000 ); /* Restzeit in Sekunden */
var num = Math.floor( delta / 86400 );
var text = "Tage: " + num
delta %= 86400;
num = Math.floor( delta / ( 3600 ) );
text += " Stunden: " + num;
delta %= 3600;
num = Math.floor( delta / 60 );
text += " Minuten: " + num;
delta %= 60;
text += " Sekunden: " + Math.floor( delta );

document.getElementById("printhis").firstChild.dat a = text;
}

setInterval("countDown()",1000);

</script>

Achtung: die per PHP gesetzte Endzeit muß im UTC-Format sein.

viel Glück



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.