Archivlink: javarea.de Forum > JavaScript > Bei Countdown zusätzlich Uhrzeit als Endzeit eingeben
Vollständigen Link anzeigen: javarea.de Forum > JavaScript > Bei Countdown zusätzlich Uhrzeit als Endzeit eingeben

Pages: [1]

geschrieben von Siegbert am 04.05.2006 - 09:17
Hallo!

Ich plane derzeit in meinem Forum welches php-mäßig läuft einen Countdown einzusetzen der am 10. Juni 2006 um 12 Uhr enden soll. Das Problem ist das, daß ich als Endzeit nur den 10. Juni 2006 eingeben kann aber nicht 12 Uhr. Wie kriege ich das hin?

Hier einmal der Teil wo was am Script geändert werden muß. Weiß nur nicht was?

HTML-Quelltext
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42: 
43: 
44: 
45: 
46: 
47: 
48: 
49: 
50: 
51: 
52: 
53: 
54: 
55: 
56: 
57: 
58: 
59: 
60: 
61: 
62: 
63: 
64: 
65: 
66: 
67: 
68: 
69: 
70: 
71: 
72: 
73: 
74: 
75: 
76: 
77: 
78: 
79: 
80: 
81: 
82: 
83: 
84: 
85: 
86: 
87: 
88: 
<table cellpadding="4" cellspacing="1" border="0" style="width:90%" class="tableinborder">
  <tr>
    <td class="tabletitle" align="center"><span class="smallfont">
      <script language="JavaScript1.2">
      function setcountdown(theyear,themonth,theday) {
      yr=theyear;mo=themonth;da=theday
      }
      
      setcountdown(2006,06,10)
      
      var occasion="bis zum ersten Spiel der TENGO-HANDBALL.de All Star Spiele 2006"
      var message_on_occasion="<b>Die TENGO-HANDBALL-de All Star Spiel 2006 laufen seit 12 Uhr in Bardenberg!</b>"
      var countdownwidth='600px'
      var countdownheight='22px'
      var countdownbgcolor=''
      var opentags=''
      var closetags=''
      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+ " Tage, "+dhour+" Stunden, "+dmin+" Minuten und "+dsec+" Sekunden bis "+occasion+closetags
      }
      setTimeout("countdown()",1000)
      }
      </script>
      </span>
    </td>
  </tr>

</table>


Weiß jemand eine Lösung?

Gruß, Sigi

geschrieben von Hawk am 04.05.2006 - 09:31
Hallo,

hier ein Script da kannst du alles Einstellen.

PHP-Quelltext
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42: 
43: 
44: 

<?
<script language="JavaScript">
<!--
function 
clock(){
var 
diffMonths=-1diffDays=-1diffHours=-1diffMins=-1
var compDat = new Date("Jun 09, 2006 18:00:00")
var 
msPerMonth 31 24 60 60 1000
var msPerDay 24 60 60 1000
var msPerHour 60 60 1000
var msPerMin 60 1000
var msPerSec 1000

     
var today = new Date()
     var 
changeD diffDays
     
var changeH diffHours
     
var changeMin diffMins
     
var diffMs compDat.getTime() - today.getTime()
     
diffDays Math.floor(diffMs msPerDay)
     
diffMs -= diffDays msPerDay
     diffHours 
Math.floor(diffMs msPerHour)
     
diffMs -= diffHours msPerHour
     diffMins 
Math.floor(diffMs msPerMin)
     
diffMs -= diffMins msPerMin
     
var diffSecs Math.floor(diffMs msPerSec)
     if(
diffDays 10diffDays '0' +diffDays;
     if(
diffHours 10diffHours '0' +diffHours;
     if(
diffMins 10diffMins '0' +diffMins;
     if(
diffSecs 10diffSecs '0' +diffSecs;
     if(
changeD!=diffDays||changeH!=diffHours||changeMin!=diffMinsdocument.getElementById('ablauf').innerHTML="Es sind noch <font color='red'> "diffDays +"</font> Tage <font color='red'>" diffHours +"</font> Stunden <font color='red'>" diffMins +"</font> Minuten <font color='red'> " diffSecs +"</font> Sekunden bis zur Fussball WM"
     
timerID setTimeout("clock()",1000)}

//-->
</script>
<noscript></noscript>
</head>
<body >
<div id="ablauf">
<script>clock()</script>
</div>


</body>
</html>
?>


geschrieben von René am 04.05.2006 - 10:13
... oder den hier 6. Beitrag http://www.javarea.de/forum/showthr....adid=10776


Powered by: JBB v.2.0.4 Copyright ©2000-2006, www.javarea.de.