中文(繁体)
<!-- 把如下程式碼加入<body>區域中 --> <SCRIPT LANGUAGE="JavaScript"> <!-- Start 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('訪客姓名', 訪客姓名, exp);返回訪客姓名; } 函數 When(info){ var rightNow = new Date() var WWHTime = 0; WWHTime = GetCookie('WWhenH') WWHTime = WWHTime * 1 var lastHereFormatting = new Date(WWHTime); var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate() var lastHereInDateFormat = "" + lastHereFormatting; var dayOfWeek = lastHereInDateFormat.substring(0,3) var dateMonth = lastHereInDateFormat.substring(4,11) var timeOfDay = lastHereInDateFormat.substring(11,16) var 年 = lastHereInDateFormat.substring(11,16) var 年 = lastHereDateFormat. , " + dateMonth + " at " + timeOfDay SetCookie("WWhenH", rightNow.getTime(), exp) return WWHText } function Count(info){ var WWHCount = GetCookie('WWHCount') if (WWHCount == null) { WWH 計數= 0; } 其他{ WWHCount++; SetCookie('WWHCount',WWHCount,exp);返回 WWHCount; } function set(){ VisitorName = Prompt("你是誰?"); SetCookie('訪客姓名', 訪客姓名, exp); SetCookie('WWHCount', 0, exp); SetCookie('WWhenH', 0, exp); } function getCookieVal(offset) { var endstr = document.cookie.indexOf(";", offset); if (endstr == -1) endstr = document.cookie.length;返回 unescape(document.cookie.substring(offset, endstr)); } function GetCookie (name) { var arg = name + "=; var alen = arg.length; var clen = document.cookie.length;變數我 = 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) 中斷;返回空值; } function SetCookie (姓名, 值) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var 過期 = (argc > 2) ? argv[2]:空; var 路徑 = (argc > 3) ? argv[3]:空; var 域 = (argc > 4) ? argv[4]:空; var secure = (argc > 5) ? argv[5] :假; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ?" " : ("; 路徑= = + 路徑)) + ((域== null) ? "" : ("; 域= = + 域)) + ((安全== true) ? "; 安全性" : "" ); } function DeleteCookie (name) { var exp = new Date(); exp.setTime(exp.getTime() - 1); var cval = GetCookie(名稱); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } // End --> </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> document.write("Hello " + Who() + ".<br>您已經登入本站" + Count() + " 次了.<br>上次登入是:" + When() +"."); </腳本>