统计一篇文章的浏览量

简介:
<html>
<head>
    <title></title>
</head>
<body>
<script language=JavaScript>
<!--
var caution = false
function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "")
if (!caution || (name + "=" + escape(value)).length <= 4000)
document.cookie = curCookie
else
if (confirm("Cookie exceeds 4KB and will be cut!"))
document.cookie = curCookie
}
function getCookie(name) {
var prefix = name + "="
var cookieStartIndex = document.cookie.indexOf(prefix)
if (cookieStartIndex == -1)
return null
var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
if (cookieEndIndex == -1)
cookieEndIndex = document.cookie.length
return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}
function deleteCookie(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT"
}
}
function fixDate(date) {
var base = new Date(0)
var skew = base.getTime()
if (skew > 0)
date.setTime(date.getTime() - skew)
}
var now = new Date()
fixDate(now)
now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000)
var visits = getCookie("counter")
if (!visits)
visits = 1
else
visits = parseInt(visits) + 1
setCookie("counter", visits, now)
document.write("您是第" + visits + "位访问此文章的!")
// -->
</script>

 
</body>
</html>
AI 代码解读
目录
打赏
0
0
0
0
207
分享
相关文章
统计和TopKey
key和value的默认分隔符为tab键 设置分隔符 程序一 package org.conan.myhadoop.TopKey; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hado
1233 0
网站统计
google 统计 http://www.google.cn/intl/zh-CN_ALL/analytics/ 监控宝  统计 http://www.jiankongbao.com
678 0
统计网站的在线人数
统计网站的在线人数
137 0
B2C经典查询,统计 绝对用的上,根据日期分组统计当天各种支付方式的销售数量和销售额
declare @sql varchar(8000) set @sql = 'select CONVERT(varchar(10), OrderDate, 120) as 日期' select @sql = @sql + ' , sum(...
962 0
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等