js实现动态显示时间效果

时间:2017-03-06    点击:158   

话不多说,请看代码:

<!DOCTYPE HTML> 
<html> 
<head> 
<meta charset="utf-8"> 
<title>时间显示器</title>  
</head> 
<body>
    <div id="d"></div> 
    <script type="text/javascript"> 
        var nowTime ;
        function play(){
        var time = new Date();
        nowTime = time.getFullYear()+"年"+time.getMonth()+"月"+time.getDate()+"日"+time.getHours()+"时"+time.getMinutes()+"分"+time.getSeconds()+"秒";
        document.getElementById("d").innerHTML = nowTime;
        }
        setInterval(play,1000);
    </script>     
</body> 
</html>

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持本站!

jQuery Validate 相关参数及常用的自定义验证规则
jQuery在header中设置请求信息的方法
Vue.js 2.0中select级联下拉框实例
jquery获取select,option所有的value和text的实例
vuejs开发组件分享之H5图片上传、压缩及拍照旋转的问题处理
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved