<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
var day_span = 90;
var this_day = new Date();
this_day.setTime(this_day.getTime() + (day_span*24*60*60*1000));
function Visitor(info){
var GuestName = GetCookie('GuestName')
if (GuestName == null) {
GuestName = prompt("お名前をどうぞ!");
SetCookie ('GuestName', GuestName, this_day);
}
return GuestName;
}
function LastVisitDayTime(info){
var rightNow = new Date();
var LastVisitTime = 0;
LastVisitTime = GetCookie('LastTime');
LastVisitTime = LastVisitTime * 1;
var lastHereFormatting = new Date(LastVisitTime);
var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) +
lastHereFormatting.getDate()
var lastHereInDateFormat = "" + lastHereFormatting;
var Month = conv_jpn(lastHereInDateFormat.substring(4,7));
var date = lastHereInDateFormat.substring(8,11);
var tm_of_day = lastHereInDateFormat.substring(11,19);
var year = lastHereInDateFormat.substring(29,33);
var WWHText = year +"/"+Month +"/"+date+" "+ tm_of_day;
SetCookie ("LastTime", rightNow.getTime(), this_day);
return WWHText;
}
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;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString()));
}
function conv_jpn(_month) {
switch (_month) {
case "Jan":
return "01";
break;
case "Feb":
return "02";
break;
case "Mar":
return "03";
break;
case "Apr":
return "04";
break;
case "May":
return "05";
break;
case "Jun":
return "06";
break;
case "Jul":
return "07";
break;
case "Aug":
return "08";
break;
case "Sep":
return "09";
break;
case "Oct":
return "10";
break;
case "Nov":
return "11";
break;
case "Dec":
return "12";
break;
}
}
//-->
</SCRIPT>
<BODY>
<CENTER>
<SCRIPT LANGUAGE="JavaScript">
document.write("ようこそ " + Visitor() + "さん、前回は " + LastVisitDayTime() +" に来られましたね。");
</SCRIPT>
</CENTER>
</BODY>
</HTML>
|