var flag=false;
function home(){
   if(flag)
      window.navigate("index.asp");
}window.setTimeout("home()",50000);document.onmousemove=function(){
  flag=true;
}document.onmouseup=function(){
  flag=true;
}document.onmouseover=function(){
  flag=true;
}document.onmouseout=function(){
  flag=true;
}document.onkeydown=function(){
  flag=true;
}document.onkeyup=function(){
  flag=true;
}
//如此这般我能想的只得这样了检测事件会不会发生,若发生flag=true;五分钟内必然转向

解决方案 »

  1.   

    <script>
    var active = true;document.onmouseover = function() {
    active = true;
    }
    document.onmouseout = function() {
    active = true;
    }
    document.onmousemove = function() {
    active = true;
    }
    document.onkeydown = function() {
    active = true;
    }
    document.onkeyup = function() {
    active = true;
    }
    function check()
    {
    if(active==true)
    {
    active = false;
    }
    else
    {
    window.location = "http://ouk.cn";
    }
    setTimeout('check()', 5*60*1000);
    }
    check();
    </script>
      

  2.   

    <BODY onload=setTimeout('location.href("firstpage.html")',50000)>
      

  3.   

    <script>
    var timer1 = setTimeout('location.href("firstpage.html")', 300000);
    function listener() {
      window.clearTimeout(timer1)
      timer1 = setTimeout('location.href("firstpage.html")', 300000);
    }
    document.onmouseover = listener()
    document.onmouseout = listener()
    document.onmousemove = listener()
    document.onkeydown = listener()
    document.onkeyup = listener()
    </script>
      

  4.   

    sorry
    ----------------------------
    <script>
    var timer1 = setTimeout('location.href("firstpage.html")', 300000);
    function listener() {
      window.clearTimeout(timer1)
      timer1 = setTimeout('location.href("firstpage.html")', 300000);
    }
    document.onmouseover = listener
    document.onmouseout = listener
    document.onmousemove = listener
    document.onkeydown = listener
    document.onkeyup = listener
    </script>