<a href="http://www.jb51.net/html/200609/1203.htm" target="_blank">防止网站内容被小偷采集的ASP代码</a><br>看了一下asp的,因为我的站是静态的所以就凑手写了个静态的javascript版的。<br>具体就不详细说明了:<br>欢迎讨论,原创转载请说明<br><div class="codetitle"> <span><a style="CURSOR: pointer" data="22852" class="copybut" id="copybut22852" onclick="doCopy('code22852')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code22852"> <br><script language="JavaScript"> <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>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><br>var now = new Date() <br>now.setTime(now.getTime() 6*1000) <br>var jb51num=10; <br>var visits = getCookie("jb51") <br>if (!visits) <br> visits = 1 <br>else <br> visits = parseInt(visits) 1 <br>if (visits>parseInt(jb51num)){ <br>alert('没有内容'); <br>location.href='http://www.jb51.net'; <br>} <br>setCookie("jb51", visits, now) <br></script><br> </div> <br><div class="htmlarea"><textarea id="runcode31138"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>瀹㈡</title></textarea></div>