hbhbhbhbhb1021(天外水火(我要多努力)) :具体我该怎么写呢?

解决方案 »

  1.   

    10秒钟后跳转
    <script language=javascript>
    function gonext()
    {
    document.location.href="http://www.csdn.net"
    }
    setTimeout("gonext()",10000)
    </script>
      

  2.   

    //网页无动作时自动跳转
    <script language="JavaScript"><!--
    var meizz; //设置一个全局变量
    var n = 300 * 1000; //时间设置(300秒)
    meizz = setTimeout("window.location.href='www.htm'", n);
    function autoJump()
    {
      clearTimeout(meizz);
      meizz = setTimeout("window.location.href='www.htm'", n);
    }document.attachEvent("onmousemove", autoJump);  //addEventListener
    document.attachEvent("onkeydown", autoJump);
    //--></script>
      

  3.   

    另外一种实现方式,感谢meizz(梅花雪) 提供的思路!
    <script language="javascript">
    var WARNING_TIMEOUT = 3;  // second
    var TIMEOUT_WARNING_URL = "first.html";
    var SL_warningPopupTimeout = null;
    var mytime = 0;
    function openWarningWindow() {
           location.href=TIMEOUT_WARNING_URL;
    }

    function startWarningTimer() {
    stopWarningTimer();
    SL_warningPopupTimeout = window.setInterval("openWarningWindow()", (WARNING_TIMEOUT)*1000);
    }

    function stopWarningTimer() {
    if (SL_warningPopupTimeout != null)
    window.clearInterval(SL_warningPopupTimeout);
    }
    document.attachEvent("onmousemove", startWarningTimer );  //addEventListener
    document.attachEvent("onkeydown", startWarningTimer);
    </script><html>
    <head>
     <title>return.jsp</title>
    </head><body onLoad="startWarningTimer()">
    <h2>自动返回?</h2></body>
    </html>
    不过这种方式只是对当前页面有效,不能对整个windows界面的鼠标键盘事件进行监听,不知道在浏览器里能否实现?