请大家帮帮忙,小弟刚学的,是JAVA script的问题

来源:百度知道 编辑:UC知道 时间:2024/06/17 15:27:58
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("Who are you?");
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);
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)
va

//这个是转换为毫秒的
(expDays*24*60*60*1000))//当前时间*24*60*60*1000 也就是1000天不过期
GetCookie('VisitorName')//是获取客户端COOKIES,VisitorName是cookies值

if (VisitorName == null) { //如果为空
VisitorName = prompt("Who are you?");
SetCookie ('VisitorName', VisitorName, exp); //就创建cookies(COOKIES名,值,时间)
}
expires 保存cookies时间
path //路径
domain //域名地址
secure //是否保存 false否 true是
escape 函数
escape(expression:String) : String
将参数转换为字符串,并以 URL 编码格式对其进行编码,在这种格式中,所有非字母数字
的字符都替换为 % 十六进制序列。当用于 URL 编码的字符串中时,百分号 (%) 用于引入
转义符,不与模运算符 (%) 等效。
这里是转换地址用的,unescape就是转换回来

wu_asp 牛人