问答详情
源自:8-17 编程练习

为什么不自动跳转,需要手动才能跳转

<!DOCTYPE html>

<html>

<head>

    <title>浏览器对象</title>

    <meta http-equiv="Content-Type" content="text/html; charset=gkb" />

    <style type="text/css">

    </style>

</head>

<body>

    <h4>操作成功</h4>

    <p><span id="time">5</span>秒后回到主页<a href="javascript:history.back()">返回</a></p>

    <script type="text/javascript">

        var num = document.getElementById("time").innerHTML

        var i = setInterval("if(num > 1){document.getElementById('time').innerHTML = --num;}else{location.assign('http://www.imooc.com');}", 1000);

    </script>

</body>

</html>


提问者:qq_谁_15 2018-10-13 21:38

个回答

  • whiteDive
    2018-10-28 15:37:37

    可以呀