Português
<!--把如下代码加入<body>区域中 --> <SCRIPT LANGUAGE="JavaScript"> <!-- Start var expDays = 30; var exp = nova Data(); exp.setTime(exp.getTime() + (expDays*24*60*60*1000)); function Who(info){ var VisitorName = GetCookie('VisitorName') if (VisitorName == null) { VisitorName = prompt("Quem é você?"); SetCookie('NomeVisitante', NomeVisitante, exp); } return NomeVisitante; } function 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 year = lastHereInDateFormat.substring(23,25) var WWHText = dayOfWeek + " , " + dateMonth + " at " + timeOfDay SetCookie("WWhenH", rightNow.getTime(), exp) return WWHText } function Count(info){ var WWHCount = GetCookie('WWHCount') if (WWHCount == null) { WWHCount = 0; } else{ WWHCount++; } SetCookie('WWHCount', WWHCount, exp); retornar WWHCount; } function set(){ VisitorName = prompt("Quem é você?"); SetCookie('NomeVisitante', NomeVisitante, exp); SetCookie('WWHCount', 0, exp); SetCookie('WQuandoH', 0, exp); } function getCookieVal(offset) { var endstr = document.cookie.indexOf(";", deslocamento); if (endstr == -1) endstr = document.cookie.length; retornar unescape(document.cookie.substring(offset, endstr)); } function GetCookie (nome) { var arg = nome + "="; var alen = arg.comprimento; var clen=document.cookie.length; var eu = 0; enquanto (i <clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; se (i == 0) quebrar; } retornar nulo; } function SetCookie (nome, valor) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expira = (argc> 2)? argv[2]: nulo; var caminho = (argc> 3)? argv[3]: nulo; var domínio = (argc> 4)? argv[4]: nulo; var seguro = (argc> 5)? argv[5]: falso; document.cookie = nome + "=" + escape (valor) + ((expira == nulo) ? "" : ("; expira = + expira.toGMTString())) + ((caminho == nulo) ?" " : ("; caminho=" + caminho)) + ((domínio == nulo) ? "" : ("; domínio=" + domínio)) + ((seguro == verdadeiro) ? "; seguro" : "" ); } function DeleteCookie (nome) { var exp = new Date(); exp.setTime(exp.getTime() - 1); var cval = GetCookie(nome); document.cookie = nome + "=" + cval + "; expira=" + exp.toGMTString(); } // Fim --> </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> document.write("Hello " + Who() + ". <br>您已经登录本站" + Count() + " 次了.<br>上次登录是:" + When() +"."); </SCRIPT>