少年希特勒 在线播放:如何在网页中做:”你是第几名访问者”.

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/24 19:36:25
回答者:运行 - 进士出身 八级

这位哥哥的回答怎么不行,能不能详细点.

计数器呗
<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>

申请一个免费计数器。
或者到www.ajiang.net下载计数器程序放自己空间里

申请一个免费计数器
http://www.xxinfo.ha.cn/dnwl/counter/counter.htm
有使用详解~

如果你在自己编写程序,有两种方法:
1 把计数器做到系统环境里面,缺点是服务器重起后数值归零。
2 把计数器做到一个数据库里面

建议放置统计程序,51.la这样的,可以了解都谁看你的网站

在frontpage中,有插入组件中就有计数器,非常简单!