应该有两个方法吧,要不就是禁止刷新,要是就是刷新之后还是继续计时
目前的计时代码如下 var minutes;
 function sessionTimeout()
  {
  var label=document.getElementById("lblTime");
  minutes=parseInt(label.value);
  minutes=minutes-1;
  label.value=minutes.toString();
  if(minutes<=0)
  {
  alert("您已超时");
  top.location.href='login.aspx';//转到登陆页
  clearInterval(sessionTimeout);
  }
  }
  window.setInterval(sessionTimeout,1000);

解决方案 »

  1.   

            if (minutes == 0)
      

  2.   

    随便不经意地点一下浏览器的惊叹号,还能停止一切javascript呢!
      

  3.   

      <script>
        function SetCookie(sName, sValue) {
          document.cookie = sName + "=" + escape(sValue);
          var date = new Date();
          date.setMonth(date.getMonth() + 1);
          document.cookie += ("; expires=" + date.toUTCString());
        }
        function GetCookie(sName) {
          var aCookie = document.cookie.split("; ");
          for (var i = 0; i < aCookie.length; i++) {
            // a name/value pair (a crumb) is separated by an equal sign
            var aCrumb = aCookie[i].split("=");
            if (sName == aCrumb[0])
              return unescape(aCrumb[1]);
          }
          // a cookie with the requested name does not exist
          return null;
        }
        var minutes = 50;//初始值
        function sessionTimeout() {
          var label = document.getElementById("lblTime");
          if (GetCookie("d") != null) minutes = parseInt(GetCookie("d"))
          minutes = minutes - 1;
          label.value = minutes.toString();
          SetCookie("d", minutes);
          if (minutes <= 0) {
            alert("您已超时");
            top.location.href = 'login.aspx'; //转到登陆页
            //clearInterval();
          }
        }
        window.setInterval(sessionTimeout, 1000);
      </script>
      

  4.   

    注意:客户端即时跟服务器超时是2吗事,即时没有到时间,服务器端也可能超时了,需要再次Login
      

  5.   

    var label=document.getElementById("lblTime");
    记录到cookie,判断cookie值function SetCookie(name,value)
    {
      var Days = 30;  
      var exp = new Date();   
      exp.setTime(exp.getTime() + Days*24*60*60*1000);
      document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
    }
    function getCookie(name)   
    {
      var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
      if(arr != null) return unescape(arr[2]); return null;
    }
      

  6.   

    cookie来保存值,或者是永久的保存下来
      

  7.   

    好思路用cookies记录时间先获取cookies里的时间值。。
      

  8.   

    用AJAX中的TIMER可以做到的啊,还不用上面这么麻烦了!!!