Cherish_ws 2013年09月19日
不能正常显示
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>
<script>
function getCookieValue(cookieName)
{
var cookieValue = document.cookie;
var cookieStartAt = cookieValue.indexOf(" " + cookieName + "=");
if(cookieStartAt == -1)
{
cookieStartAt = cookieValue.indexOf(cookieName + "=");
}
if(cookieStartAt == -1)
{
cookieValue == null;
}
else
{
cookieSatrtAt = cookieValue.indexOf("=", cookieStartAt)+1;
cookieEndsAt = cookieValue.indexOf(";", cookieStartAt);
if(cookieEndsAt == -1)
{
cookieEndsAt == cookieValue.length;
}
cookieValue = unescape(cookieValue.substring(cookieStartAt,cookieEndsAt));
}
return cookieValue;
}
document.cookie ="name=Bob;age=20";
document.write(getCookieValue("age"));
</script>
</body>
</html>
...全文
44 点赞 收藏 1
写回复
1 条回复

还没有回复,快来抢沙发~

发动态
发帖子
JavaScript
创建于2007-09-28

5.1w+

社区成员

22.3w+

社区内容

Web 开发 JavaScript
社区公告
暂无公告