<HTML> <HEAD> <script language="JavaScript"> <!-- function testCookies() { var takesCookies; document.cookie = 'IAcceptCookies=yes'; if(document.cookie == '') takesCookies = false; else takesCookies = true; document.cookie = 'IAcceptCookies=yes; expires=Thu, 01-Jan-1998 00:00:00 GMT'; return takesCookies; } function bakeCookie (name, value, expiry, path, domain, secure) { document.cookie = name + '=' + escape(value) + ((expiry)?(';expires=' + ((new Date((new Date()).getTime() + expiry*86400000)).toGMTString())):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'') + ((secure && (secure == true))?'; secure':''); } function showCookie(name){ return unescape(getCookie(name)); } function getCookie(name) { if(document.cookie == '') return false; else { var cookieStart, cookieEnd; var cookieString = document.cookie; cookieStart = cookieString.indexOf(name); if(cookieStart != -1) { cookieStart += name.length + 1; cookieEnd = cookieString.indexOf(';', cookieStart); if(cookieEnd == -1) cookieEnd = cookieString.length; return cookieString.substring(cookieStart, cookieEnd); } else { return false; } } } function eatCookie(name, path, domain) { var cookieValue = getCookie(name); if(cookieValue) { document.cookie = name + '=' + cookieValue + '; expires=Thu, 01-Jan-1998 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:''); } } // --> </script> <script> <!-- function hitCounter(){ if (testCookies()){ var num = getCookie('hitcount'); if (num == false){ bakeCookie('hitcount',0); num = 0; } bakeCookie('hitcount',parseInt(num)+1,'3650'); return showCookie('hitcount'); } else return false; } // --> </script> </HEAD> <BODY> <P>You have been to this page <B><SCRIPT>document.write(hitCounter())</SCRIPT></B> times.</P> </BODY> </HTML> |
Данная программа была написана DeeCo
|