{% else-1 %}
Пример:
Здравствуйте. Вы были тут уже 1 раз .
Последний раз: Вторник, 8. Января.

                        
<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();
exp.setTime (exp.getTime() - 1);
// This cookie is history
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

}

var expDays = 30;
var exp = new Date();

exp.setTime(exp.getTime() + (expDays*24*60*60*1000));


function name(n){
if(n != null) {
var name = name
}

else if(GetCookie('name') != null) {
var name = GetCookie('name')
}

else {
var name = prompt("Введите Ваше имя",'');

if(name == null || name == "") {
name = "null"
}

else {
SetCookie('name',name,exp);
}
}

return name;

}


function time() {
var days = new Array(7)
days[1] = "Воскресенье";
days[2] = "Понедельник";
days[3] = "Вторник";
days[4] = "Среда";
days[5] = "Четверг";
days[6] = "Пятница";
days[7] = "Суббота";

var months = new Array(12)
months[1] = "Января";
months[2] = "Февраля";
months[3] = "Марта";
months[4] = "Апреля";
months[5] = "Мая";
months[6] = "Июня";
months[7] = "Июля";
months[8] = "Августа";
months[9] = "Сентября";
months[10] = "Октября";
months[11] = "Ноября";
months[12] = "Декабря";

var today = new Date()
var day = days[today.getDay() + 1]
var month = months[today.getMonth() + 1]
var date = today.getDate()
var year = today.getYear()

var full = day + ", " + date + ". " + month + " " + year

if(GetCookie('date') != null) {
var savedate = GetCookie('date')
DeleteCookie('date')
SetCookie('date',full,exp)
return savedate
}

else {
SetCookie('date',full,exp)
return null
}
}



function amt(){


var count = GetCookie('count')

if(count == null) {
SetCookie('count','1')
return 0
}

else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}


function print(what) {
if(what == "name") {
return name()
}

else if(what == "date") {
if(time() == null) {
return "[Вы еще не были здесь!!!]"
}
else {
return time()
}
}

else if(what == "times") {
return amt()
}

}


function process(how) {
if(how == 'newname') {
SetCookie('name',prompt('Your Name?',''))
location.reload()
}

else if(how == 'newprofile') {
DeleteCookie('name')
DeleteCookie('count')
DeleteCookie('date')
location.reload()
}
}
// --End Hiding Here -->
</script>
<script>document.write("<font face=verdana size=-1>Здравствуйте, <b>" + print('name') + "</b>. Вы были тут уже <b>" + print('times') + "</b> раз . Последний раз: <b>" + print('date') +"</b>.")
</script>
1 23 0
Без комментариев...