名称:访客登记
例子:
使用方法:
复制下面的代码到你的 html 文件的 <head> 和 </head> 之间:
<script language="JavaScript">
<!-- Hide this script from old browsers --
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function Who(info){
var VisitorName = GetCookie('VisitorName')
if (VisitorName == null) {
VisitorName = prompt("请输入姓名:",'');
SetCookie ('VisitorName', VisitorName, exp);
}
return VisitorName;
} function When(info){
var rightNow = new Date()
var WWHTime = 0;
WWHTime = GetCookie('WWhenH')
WWHTime = WWHTime * 1
var lastHereFormatting = new Date(WWHTime); // Date-i-fy that
number
var intLastVisit = (lastHereFormatting.getYear() * 10000)+
(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate()
var lastHereInDateFormat = "" + lastHereFormatting; // Gotta use
substring functions
var dayOfWeek = lastHereInDateFormat.substring(0,3)
var dateMonth = lastHereInDateFormat.substring(4,11)
var timeOfDay = lastHereInDateFormat.substring(11,16)
var year = lastHereInDateFormat.substring(23,25)
var WWHText = dayOfWeek + ", " + dateMonth + " at " + timeOfDay //
display
SetCookie ("WWhenH", rightNow.getTime(), exp)
return WWHText;
}
function Count(info){
评论0