<p><code><html><br /><head><br /><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><br /><title>记住每个来访者的次数</title><br /><script language="JavaScript"><br /><!--<br />var caution = false<br />function setCookie(name, value, expires, path, domain, secure) {<br /> var curCookie = name + "=" + escape(value) +<br /> ((expires) ? "; expires=" + expires.toGMTString() : "") +<br /> ((path) ? "; path=" + path : "") +<br /> ((domain) ? "; domain=" + domain : "") +<br /> ((secure) ? "; secure" : "")<br /> if (!caution || (name + "=" + escape(value)).length <= 4000)<br /> document.cookie = curCookie<br /> else<br /> if (confirm("Cookie exceeds 4KB and will be cut!"))<br /> document.cookie = curCookie<br />}<br />function getCookie(name) {<br /> var prefix = name + "="<br /> var cookieStartIndex = document.cookie.indexOf(prefix)<br /> if (cookieStartIndex == -1)<br /> return null<br /> var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)<br /> if (cookieEndIndex == -1)<br /> cookieEndIndex = document.cookie.length<br /> return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))<br />}<br />function deleteCookie(name, path, domain) {<br /> if (getCookie(name)) {<br /> document.cookie = name + "=" +<br /> ((path) ? "; path=" + path : "") +<br /> ((domain) ? "; domain=" + domain : "") +<br /> "; expires=Thu, 01-Jan-70 00:00:01 GMT"<br /> }<br />}<br />function fixDate(date) {<br /> var base = new Date(0)<br /> var skew = base.getTime()<br /> if (skew > 0)<br /> date.setTime(date.getTime() - skew)<br />}<br />var now = new Date()<br />fixDate(now)<br />now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000)<br />var visits = getCookie("counter")<br />if (!visits)<br /> visits = 1<br />else<br /> visits = parseInt(visits) + 1<br />setCookie("counter", visits, now)<br />document.write("欢迎您第 " + visits + " 次来到本站点")<br />// --><br /></script><br /></head><br /><body><br /> <br /><p></p><br /><p></p> <br /> <br /></body><br /></html></code></p>