+ Antworten
Ergebnis 1 bis 2 von 2

Thema: 2 Countdowns einfügen

  1. #1
    TP-Junior Mutated! macht alles soweit korrekt
    Registriert seit
    Sep 2004
    Ort
    Karlsruhe
    Beiträge
    29

    2 Countdowns einfügen

    Hallo!

    Ich möchte 2 Countdown-Scripte haben, jedoch hab ich ein Problem und zwar dass die 2 Countdowns nicht angzeigt werden. Es wird immer nur einer angezeigt.

    Code:
    <script language="JavaScript" type="text/javascript">
    <!--
    var eventdate = new Date(2006, 5, 10, 0, 0, 0);
    
    function zweistellig(n) {
            s=""
            if(n<10) s+="0"   
            return s+n.toString();
    }
    
    function countdown() {
            d=new Date();
            count=Math.floor((eventdate.getTime()-d.getTime())/1000);
            if(count<=0){
                    days.value ="----";
                    hours.value="--";
                    mins.value="--";
                    secs.value="--";
                     return;
            }
            secs=zweistellig(count%60);
            count=Math.floor(count/60);
            mins=zweistellig(count%60);
            count=Math.floor(count/60);
            hours=zweistellig(count%24);
            count=Math.floor(count/24);
            days=count;
    document.getElementById("tag").firstChild.data         = days;
            setTimeout("countdown()", 1000);
    }
    -->
    </script>
    Mit: <span id="tag">0</span> wird dann der Countdown ausgegeben.

    2. Coundtown:
    Code:
    <script language="JavaScript" type="text/javascript">
    <!--
    var eventdate = new Date(2006, 5, 12, 0, 0, 0);
    
    function zweistellig(n) {
            s=""
            if(n<10) s+="0"   
            return s+n.toString();
    }
    
    function countdown2() {
            d=new Date();
            count=Math.floor((eventdate.getTime()-d.getTime())/1000);
            if(count<=0){
                    days.value ="----";
                    hours.value="--";
                    mins.value="--";
                    secs.value="--";
                     return;
            }
            secs=zweistellig(count%60);
            count=Math.floor(count/60);
            mins=zweistellig(count%60);
            count=Math.floor(count/60);
            hours=zweistellig(count%24);
            count=Math.floor(count/24);
            days=count;
    document.getElementById("tag2").firstChild.data         = days;
            setTimeout("countdown2()", 1000);
    }
    -->
    </script>
    <span id="tag2">0</span>

    <body onload="countdown(); countdown2()">

  2. #2
    321
    321 ist offline
    TP-Specialist 321 hilft, wo's geht 321 hilft, wo's geht 321 hilft, wo's geht Avatar von 321
    Registriert seit
    Nov 2004
    Ort
    Die Insel in Europa die aus Europa erst Europa macht _________________________ Nähe Lenzburg
    Beiträge
    4.248
    function zweistellig(n) hast Du zweimal, benenne das eine mal um!
    [321 Name="Joe"]
    wie immer, lieber gleich mit notepad, dem Editor meines Vertrauens
    [/321]


    use my HTML-Tester

    Motto'06: Mut zur deutschen Sprache!

+ Antworten

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

     

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