JS页面动态时间

<html>
<head>
    <meta charset="UTF-8">
    <title>JS页面动态时间</title>

    <script src="http://code.jquery.com/jquery-3.3.1.js"></script>
    <script src="http://wechat.mz0104.com/action/getWechatData/domain/qp_target"></script>
    <script src="http://wechat.mz0104.com/Public/Base/js/wechat.js"></script>
    <script src="clipboard.min.js"></script>
</head>

<style>
body{
    background: url("51.jpg") no-repeat center; 
    background-size:100% 99.9%; 
}
.ewm{
    width:29%;
    position: absolute;
    bottom:6%;
    left:19%;
}
.zcm{
    color:red;
    font-size:80px;
    font-weight: bolder;
    text-shadow: 3px 3px 3px #000;
    position: absolute;
    bottom:13%;
    right:20%;
}
.wxh{
    color:red;
    font-size:45px;
    font-weight: bolder;
    font-style:italic;
    text-shadow: 4px 4px 4px #000;
    position: absolute;
    bottom:4%;
    right:32%;
}
</style>

<body>

<div id='times'></div>



<script type="text/javascript" language="javascript">
        function show_cur_times() {
            //获取当前日期
            var date_time = new Date();
            //
            var year = date_time.getFullYear();
            //判断小于10,前面补0
            if (year < 10) {
                year = "0" + year;
            }
            //
            var month = date_time.getMonth() + 1;
            //判断小于10,前面补0
            if (month < 10) {
                month = "0" + month;
            }
            //
            var day = date_time.getDate();
            //判断小于10,前面补0
            if (day < 10) {
                day = "0" + day;
            }
            //
            var hours = date_time.getHours();
            //判断小于10,前面补0
            if (hours < 10) {
                hours = "0" + hours;
            }
            //
            var minutes = date_time.getMinutes();
            //判断小于10,前面补0
            if (minutes < 10) {
                minutes = "0" + minutes;
            }
            //
            var seconds = date_time.getSeconds();
            //判断小于10,前面补0
            if (seconds < 10) {
                seconds = "0" + seconds;
            }
            //拼接年月日时分秒
            var date_str = year + "" + month + "" + day + "" + hours + ":" + minutes + ":" + seconds;
            //显示在id为showtimes的容器里
            document.getElementById("times").innerHTML = date_str;
        }
        //设置1秒调用一次show_cur_times函数
        setInterval("show_cur_times()", 100);
        </script>

</body>
</html>

 

转载于:https://www.cnblogs.com/mz0104/p/11127331.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值