zoukankan      html  css  js  c++  java
  • [JS12] 统计访问次数

     1 <html>
     2 <head>
     3     <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
     4         <title>New Page 5</title>
     5     <meta name="GENERATOR" content="Microsoft FrontPage 3.0">
     6     <script language="JavaScript">
     7         <!--
     8         var caution = false
     9         function setCookie(name, value, expires, path, domain, secure) {
    10             var curCookie = name + "=" + escape(value) +
    11             ((expires) ? "; expires=" + expires.toGMTString() : "") +
    12             ((path) ? "; path=" + path : "") +
    13             ((domain) ? "; domain=" + domain : "") +
    14             ((secure) ? "; secure" : "")
    15             if (!caution || (name + "=" + escape(value)).length <= 4000)
    16                 document.cookie = curCookie
    17             else if (confirm("Cookie exceeds 4KB and will be cut!"))
    18                 document.cookie = curCookie
    19         }
    20         function getCookie(name) {
    21             var prefix = name + "="
    22             var cookieStartIndex = document.cookie.indexOf(prefix)
    23             if (cookieStartIndex == -1)
    24                 return null
    25             var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
    26             if (cookieEndIndex == -1)
    27                 cookieEndIndex = document.cookie.length
    28             return unescape(document.cookie.substring(cookieStartIndex + prefix.length,
    29             cookieEndIndex))
    30         }
    31         function deleteCookie(name, path, domain) {
    32             if (getCookie(name)) {
    33                 document.cookie = name + "=" +
    34                 ((path) ? "; path=" + path : "") +
    35                 ((domain) ? "; domain=" + domain : "") +
    36                 "; expires=Thu, 01-Jan-70 00:00:01 GMT"
    37             }
    38         }
    39         function fixDate(date) {
    40             var base = new Date(0)
    41             var skew = base.getTime()
    42             if (skew > 0)
    43             date.setTime(date.getTime() - skew)
    44         }
    45         var now = new Date()
    46         fixDate(now)
    47         now.setTime(now.getTime() + 730 * 24 * 60 * 60 * 1000)
    48         var visits = getCookie("counter")
    49         if (!visits)
    50             visits = 1
    51         else
    52             visits = parseInt(visits) + 1
    53         setCookie("counter", visits, now)
    54         document.write("<font size=6 color=red>欢迎您,您是第:" + visits + " 个访问该站点的访客")
    55         // -->
    56     </script>
    57 </head>
    58 <body>
    59     <p align="right"> </p>
    60 </body>
    61 </html>
  • 相关阅读:
    转:yum和aptget用法及区别
    APT upgrade 和 distupgrade 的差別
    flickr api 入门教程
    查看FileZila 快速连接密码
    Freemium模式
    asp.net 开发环境搭建
    flickr api authentication
    转:虚拟机VirtualBox中Ubuntu无法全屏解决方法
    转:网页设计中的默认字体样式详解
    Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  • 原文地址:https://www.cnblogs.com/zjutlitao/p/3726828.html
Copyright © 2011-2022 走看看