原生JS文字循环显示

  <div class="row" id="row02" style="display: ">
                <div class="fengpanBlock">
                    <p> 封盘,开奖中<span id="dotdotdot">....</span></p>
                </div>
                <script>
                    var page2Txt = '....';
                    var page2TxtShow = document.getElementById('dotdotdot');
                    var i = 0;
                    var timer = setInterval(function () {
                        page2TxtShow.innerHTML = page2Txt.substring(0, i);
                        i++;
                        if (page2TxtShow.innerHTML == page2Txt) {
                            page2TxtShow.innerHTML = "";
                            i = 0;
                        }
                    }, 1000);
                </script>
            </div>
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页