Code
<script language="javascript">
<!--
function getcookieval (offset) {
var endstr = document.cookie.indexof (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function getcookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getcookieval (j);
i = document.cookie.indexof(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function setcookie (name, value) {
var argv = setcookie.arguments;
var argc = setcookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.togmtstring())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function deletecookie(name) {
var exp = new date();
fixcookiedate (exp);
exp.settime (exp.gettime() - 1);
var cval = getcookie (name);
if (cval != null)
document.cookie = name + "=" + cval + "; expires=" + exp.togmtstring();
}
var expdate = new date();
var num_visits;
expdate.settime(expdate.gettime() + (5*24*60*60*1000));
if (!(num_visits = getcookie("num_visits")))
num_visits = 0;
num_visits++;
setcookie("num_visits",num_visits,expdate);
//-->
</script>
<script language="javascript">
<!--
document.write("Вы посетили эту страницу <font color="#ff0000"><b>"+num_visits+"</b></font> раз(а).");
//-->
</script>