首页 > 其他 > 详细

时钟timer

时间:2016-05-31 19:07:53      阅读:176      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>timer</title>
<style type="text/css">
    .timetxt{
         /* Box-model盒子模型 */
        width: 300px;
        margin: 0 auto;
        margin-top: 150px;
        /* Typography排版 */
        font-size: 80px;
        font-weight: blod;
    }
</style>
</head>
<body onload="startTime()">
    <div class="timetxt" id="timetxt"></div>
</body>
<script type="text/javascript">
    function startTime(){
        var today = new Date();
        var h = today.getHours();
        var m = today.getMinutes();
        var s = today.getSeconds();
        m = checkTime(m);
        s = checkTime(s);
        document.getElementById(‘timetxt‘).innerHTML = h+‘:‘+m+‘:‘+s;
        t = setTimeout(startTime,1000);
    }

    function checkTime(i){
        if (i<10) {
            i = ‘0‘+i;
        }
        return i;
    }
</script>
</html>

时钟timer

原文:http://11254167.blog.51cto.com/11244167/1784960

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!