tp5跳转页面如何修改等待时间

1.body里的div结构改造

     <div class="system-message">
            <?php switch ($code) {?>
                <?php case 1:?>
                <!-- 成功提示 -->
                <!-- <h1>:)</h1> -->
                <div class="success-msg">
                    <img src="__STATICS__/admin/assets/images/mytip/ok.png" alt="" />
                </div>
                <p class="success"><?php echo(strip_tags($msg));?></p>
                <?php break;?>
                <?php case 0:?>
                <!-- 错误提示 -->
                <!-- <h1>:(</h1> -->
                <div class="success-msg">
                    <img src="__STATICS__/admin/assets/images/mytip/error.png" alt="" />
                </div>
                <p class="error"><?php echo(strip_tags($msg));?></p>
                <?php break;?>
            <?php } ?>
            <p class="detail"></p>
            <p class="jump">
                页面自动 <a id="href" href="<?php echo($url);?>">跳转</a> 等待时间: <b id="wait"><?php echo($wait);?></b>
            </p>
        </div>

2.改造时间

    <script type="text/javascript">
            (function(){
                var wait = document.getElementById('wait'),
                    href = document.getElementById('href').href;
                var interval = setInterval(function(){
                    var time = --wait.innerHTML;
                    if(time <= 1) {
                        //时间从3s改为1s
                        // location.href = href;
                        clearInterval(interval);
                    };
                }, 1000);
            })();
    </script>

 

展开阅读全文

没有更多推荐了,返回首页