<div class="codetitle"> <span><a style="CURSOR: pointer" data="21656" class="copybut" id="copybut21656" onclick="doCopy('code21656')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code21656"> <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> </div>