javascipt----setInterval定时器
昵称
密码

javascipt----setInterval定时器

fl0919
2021-05-10 / 0 评论 / 11 阅读 / 正在检测是否收录...
/

效果

代码

<div id="times"></div>

        <style type="text/css">
            #times {
                font-size: 66px;
            }
        </style>
        <script type="text/javascript">
            var words = ["1", "2", "3", "4", "5", "6"]
            var count = 0;

            function outword() {
                document.getElementById("times").innerText = words[count];
                count++;
                if (count == 6) {
                    count = 0;
                }
            }
            setInterval(outword, 1000);
        </script>
0

评论 (0)

取消