ユーザ設定によりクッキーファイル(CookieFile)への書き込みができない場合は、処理することができません。訪問回数を増やす場合は、違うページから読み込むか、ブラウザのリロードで試してみてください。
function setCount(n)
{
theDay=30;
setDay=new Date();
setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
expDay=setDay.toGMTString();
document.cookie="count="+n+";expires="+expDay;
}
function getCount()
{
theName="count=";
theCookie = document.cookie+";"
start=theCookie.indexOf(theName);
if(start !=-1)
{
end = theCookie.indexOf(";",start);
count = eval(unescape(theCookie.substring(start+theName.length,end)));
document.write(count + "Time Visit");
setCount(count+1);
}else{
document.write("Welcome, First Time Visit!");
setCount(2);
}
}
getCount();