还者用服务器Application对象记录下来。

解决方案 »

  1.   

    也可用Application记录上次访问时间,方法如下:
    <%
    oldtime=Application("oldtime")
    Application("oldtime")=now()
    %>
    <%="最后一次访问的时间是:" & formatdatetime(oldtime,1) & " " & formatdatetime(oldtime,4)%>
      

  2.   

    <script language=javascript>function GetCookie (name) {
      var arg = name + "=";
      var alen = arg.length;
      var clen = document.cookie.length;
      var i = 0;
      while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
          return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break; 
      }
      return null;
    }function getCookieVal (offset) {
      var endstr = document.cookie.indexOf (";", offset);
      if (endstr == -1)
        endstr = document.cookie.length;
      return unescape(document.cookie.substring(offset, endstr));
    }
    function SetCookie (name, value) {
    var the_date = new Date("December 31, 3666");
    var the_cookie_date =the_date.toGMTString();
    document.cookie = name + "=" + escape (value)+ ";expires=" +the_cookie_date;
    }
    function window.onload(){//B页面打开时设置cookieA=B
    var last=GetCookie("cookieA");
    if(last) {
    var temp=last.split(";");
    alert("The last time you visit this page is:"+temp[0]);
    }
    else 
    alert("欢迎您第一次访问!");
    }function window.onunload(){//B页面打开时设置cookieA=B
    var d=new Date();
    SetCookie("cookieA",d)
    }function acceptA(){//接收cookieA,并进行处理
    if(GetCookie("cookieA")=="0"){
    self.opener=null;
    self.close();
    }
    }
    </script>