码迷,mamicode.com
首页 > 其他好文 > 详细

万年历

时间:2017-09-30 10:06:56      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:new   span   date()   bsp   var   pre   title   eth   amp   

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>

    <body>
        <span id="span"></span>
    </body>

</html>
<script>
    var span = document.getElementById("span");

    function time_get() {
        var time = new Date();
        var year = time.getFullYear();
        var month = time.getMonth() + 1;
        var day = time.getDay();
        var hour = time.getHours();
        var minute = time.getMinutes();
        var second = time.getSeconds()<10?"0"+time.getSeconds():time.getSeconds();

        var time_str = year + "-" + month + "-" +
            day + "&nbsp;&nbsp;" + hour + ":" +
            minute + ":" + second;

        span.innerHTML = time_str;
    }
    window.setInterval("time_get()",500);
    
    
</script>

 

万年历

标签:new   span   date()   bsp   var   pre   title   eth   amp   

原文地址:http://www.cnblogs.com/yangchuanqi/p/7613245.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!