相思资源网 Design By www.200059.com
<%
Response.Cookies("Cookie1")("key1") = "KeyValue2"
%>
<script language="javascript">
String.prototype.get = function(name){
var reg = new RegExp("(^|&|\\?)" + name + "=([^&]*)(&|$)"),r;
if(r=this.match(reg))
return unescape(r[2]);
return null;
}
//获取并返回 cookie 值
//不区分 cookieName 的大小写
//dfltValue 为默认返回值
//不考虑子键
function RequestCookies(cookieName)
{
var lowerCookieName = cookieName.toLowerCase();
var cookieStr = document.cookie;
if (cookieStr == "")return "";
var cookieArr = cookieStr.split("; ");
var pos = -1;
for (var i=0; i<cookieArr.length; i++){
pos = cookieArr[i].indexOf("=");
if (pos > 0) {
if (cookieArr[i].substring(0, pos).toLowerCase() == lowerCookieName)
{
return unescape(cookieArr[i].substring(pos+1, cookieArr[i].length));
}
}
}
return "";
}
document.write("读取名称为 ab 的 cookie..." + RequestCookies("Cookie1").get("key1"));
-->
</script>
Response.Cookies("Cookie1")("key1") = "KeyValue2"
%>
<script language="javascript">
String.prototype.get = function(name){
var reg = new RegExp("(^|&|\\?)" + name + "=([^&]*)(&|$)"),r;
if(r=this.match(reg))
return unescape(r[2]);
return null;
}
//获取并返回 cookie 值
//不区分 cookieName 的大小写
//dfltValue 为默认返回值
//不考虑子键
function RequestCookies(cookieName)
{
var lowerCookieName = cookieName.toLowerCase();
var cookieStr = document.cookie;
if (cookieStr == "")return "";
var cookieArr = cookieStr.split("; ");
var pos = -1;
for (var i=0; i<cookieArr.length; i++){
pos = cookieArr[i].indexOf("=");
if (pos > 0) {
if (cookieArr[i].substring(0, pos).toLowerCase() == lowerCookieName)
{
return unescape(cookieArr[i].substring(pos+1, cookieArr[i].length));
}
}
}
return "";
}
document.write("读取名称为 ab 的 cookie..." + RequestCookies("Cookie1").get("key1"));
-->
</script>
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无通过JAVASCRIPT读取ASP设定的COOKIE的评论...