Timp ramas pana la expirarea anuntului phpbb

Întrebări / Probleme / Moduri / .etc
Post Reply
User avatar
tataieee
Administrator
Posts: 3848
Joined: 17 Sep 2014, 17:52
Nume Real: Alexandru Costin
Nivel cunoştinţe IT: 10
Location: Giurgiu; România
Contact:

03 Nov 2014, 21:39

Deschide overall_header.html

Caută:

Code: Select all

</head> 
Adaugă înainte:

Code: Select all

    <script language="JavaScript">
    <!--
    var year = 2012;            // in what year will your target be reached?
    var month = 11;                // value between 0 and 11 (0=january,1=february,...,11=december)
    var day = 22;                // between 1 and 31
    var hour = 0;                // between 0 and 24
    var minute = 0;            // between 0 and 60
    var second = 0;            // between 0 and 60
    var eventtext = "until the next big thing"; // text that appears next to the time left
    var endtext = "We reached the next big thing!!"; // text that appears when the target has been reached
    var end = new Date(year,month,day,hour,minute,second);
    function timeleft(){
        var now = new Date();
        if(now.getYear() < 1900)
            yr = now.getYear() + 1900;
        var sec = second - now.getSeconds();
        var min = minute - now.getMinutes();
        var hr = hour - now.getHours();
        var dy = day - now.getDate();
        var mnth = month - now.getMonth();
        var yr = year - yr;
        var daysinmnth = 32 - new Date(now.getYear(),now.getMonth(), 32).getDate();
        if(sec < 0){
            sec = (sec+60)%60;
            min--;
        }
        if(min < 0){
            min = (min+60)%60;
            hr--;    
        }
        if(hr < 0){
            hr = (hr+24)%24;
            dy--;    
        }
        if(dy < 0){
            dy = (dy+daysinmnth)%daysinmnth;
            mnth--;    
        }
        if(mnth < 0){
            mnth = (mnth+12)%12;
            yr--;
        }    
        var sectext = " seconds ";
        var mintext = " minutes, and ";
        var hrtext = " hours, ";
        var dytext = " days, ";
        var mnthtext = " months, ";
        var yrtext = " years, ";
        if (yr == 1)
            yrtext = " year, ";
        if (mnth == 1)
            mnthtext = " month, ";
        if (dy == 1)
            dytext = " day, ";
        if (hr == 1)
            hrtext = " hour, ";
        if (min == 1)
            mintext = " minute, and ";
        if (sec == 1)
            sectext = " second ";
        if(now >= end){
            document.getElementById("timeleft").innerHTML = endtext;
            clearTimeout(timerID);
        }
        else{
        document.getElementById("timeleft").innerHTML = yr + yrtext + mnth + mnthtext + dy + dytext + hr + hrtext + min + mintext + sec + sectext + eventtext;
        }
        timerID = setTimeout("timeleft()", 1000); 
    }
    window.onload = timeleft;
    //-->
    </script>
Lipesti codul

Code: Select all

<span id="timeleft"> </span>
acolo unde doresti sa apara.

Sursa: http://phpbbcodes.ro/viewtopic.php?p=907#p907
*Email: w.tataieee@gmail.com
*PayPal: w.tataieee@yahoo.com
Post Reply

Return to “phpBB 3.0.x”