if(window.confirm("确实返回首页吗?"))
{
 window.document.location.href='index.htm';
}

解决方案 »

  1.   

    to helimin19你这段代码放到我上面那段代码什么位置呢?我是想当到10秒后,先弹出框让你选择.
      

  2.   

    <script language="JavaScript"><!--
    var meizz; //设置一个全局变量
    var n = 300 * 1000; //时间设置(300秒)
    function jump()
    {
      if(confirm("确实返回首页吗?"))
        window.location.href='index.htm';
    }
    meizz = setTimeout(jump, n);
    function autoJump()
    {
      clearTimeout(meizz);
      meizz = setTimeout(jump, n);
    }document.attachEvent("onmousemove", autoJump);  //addEventListener
    document.attachEvent("onkeydown", autoJump);
    //--></script>
      

  3.   

    麻烦再帮帮忙,以下代码简单好多.
    如何在以下代码实现上述功能呢?
    <meta http-equiv="refresh" content="180;URL=index.htm">
      

  4.   

    <html><head><title>简单好多的</title></head>
    <meta http-equiv="refresh" content="2;URL=index.htm"><body onbeforeunload="return '确实返回首页吗?'">
    在body上做文章
    </body></html>
      

  5.   

    使用 refresh 的跳转开始计时点是你页面打开的时间,而不是用户的最后一次动作时间
      

  6.   

    to meizz
    是的.想起来了.
    非常感谢.