富贵资源网 Design By www.hznty.com

效果:

JS小功能(setInterval实现图片效果显示时间)实例代码

代码:
复制代码 代码如下:
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function toDou(n) {
            if (n < 10) {
                return '0' + n;
            }
            else {
                return '' + n;
            }
        }
        setInterval(
        window.onload = function () {
            var aImg = document.getElementsByTagName('img');
            var oDate = new Date();
            var str = toDou(oDate.getHours()) + toDou(oDate.getMinutes()) + toDou(oDate.getSeconds());
            for (var i = 0; i < str.length; i++) {
                aImg[i].src = 'Images/Number1/' + str[i] + '.jpg';
            }
        }, 1000);

    </script>
</head>
<body style="background-color: Black;">
    <div style="text-align: center; line-height: 600px">
        <img src="/UploadFiles/2021-04-02/0.jpg">            color: White; text-align: center; line-height: 2px;">:</span><img src="/UploadFiles/2021-04-02/0.jpg">                src="Images/Number1/0.jpg">                    src="/UploadFiles/2021-04-02/0.jpg">    </div>
</body>

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com