谁有网站访问统计的代码?今日访问量和历史访问量的?非常感谢!
- 提问者网友:蓝莓格格巫
- 2021-03-15 13:48
- 五星知识达人网友:逐風
- 2021-03-15 15:05
- 1楼网友:渡鹤影
- 2021-03-15 17:53
- 2楼网友:轻熟杀无赦
- 2021-03-15 17:11
网上有如下代码(但那是不行的,我觉得一定要和数据库结合才行;不可能在单一客户端完成。)
<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>
- 3楼网友:慢性怪人
- 2021-03-15 16:21