Jen

簡單的退伍日計算

最最最白爛的退伍日計算...
 
(其實javascript 的date()蠻煩的 - -)
 
<script type="text/javascript">
    
    var back = new Date(2009,7-1,7);
    function getdays()
    {
        var now = new Date();
        var span = back.getTime() - now.getTime();
        var days = span / (1000*60*60*24);
        
        var h = 23 - now.getHours();
        var m = 59 - now.getMinutes();
        var s = 59 - now.getSeconds();
        
        document.getElementById("text").innerHTML =  
        parseInt(days) + "¤Ñ" + h + "?pRE" + m + "?AAA" + s + "?i"; 
              
        setTimeout("getdays();",1000);
    }
    $(document).ready(function () {
        getdays();
    });

</script>
<span id="text"></span>
 
參考:
Yippee.Nethttp://www.dotblogs.com.tw/yippee/archive/2008/04/24/3464.aspx

0 意見: