不能正常显示

Cherish_ws Cherish_ws 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<!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>
...全文
评论 1
收藏 已收藏
分享
返回顶部
Cherish_ws
JavaScript 87,983 成员 224,681 内容