javascript 我要让当前页面3秒后自动跳转

JavaScript010

javascript 我要让当前页面3秒后自动跳转,第1张

搂主用我的,我帮你重写reload(),你看你行不

<script type="text/javascript" language="javascript">

function reloadyemian()//最好不要用reload这个关键字,因为很容易和其它函数冲突

{

window.location.href="http://www.baidu.com"

}

window.setTimeout("reloadyemian()",3000)

</script>

window.setTimeout("reloadyemian()",3000)

代码放在开头的<script>代码块内,试试搂主

-->

我在自己机器上成功了

setTimeout(function(){

    //$('#id').hide()

    //document.getElementById(id).style.display="none"

}, 3000 )

可以用 setInterval 或者 setTimeout  模拟

(function(){

    var index = 0,

        maxIndex = 5,

        timer

    

    function test(){

        if( index > maxIndex ){

            clearInterval(timer)

            return

        }

        alert(index)

        index++

    }

    

    timer = setInterval(test, 3000)

})()