<%
Response.Cookies("Cookie1")("key1")="KeyValue2"
%>
String.prototype.get=function(name){
varreg=newRegExp("(^|&|?)"+name+"=([^&]*)(&|$)"),r;
if(r=this.match(reg))
returnunescape(r[2]);
returnnull;
}
//获取并返回cookie值
//不区分cookieName的大小写
//dfltValue为默认返回值
//不考虑子键
functionRequestCookies(cookieName)
{
varlowerCookieName=cookieName.toLowerCase();
varcookieStr=document.cookie;
if(cookieStr=="")return"";
varcookieArr=cookieStr.split(";");
varpos=-1;
for(vari=0;i
if(pos>0){
if(cookieArr[i].substring(0,pos).toLowerCase()==lowerCookieName)
{
returnunescape(cookieArr[i].substring(pos+1,cookieArr[i].length));
}
}
}
return"";
}
document.write("读取名称为ab的cookie..."+RequestCookies("Cookie1").get("key1"));
-->