惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
I
InfoQ
H
Hackread – Cybersecurity News, Data Breaches, AI and More
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
有赞技术团队
有赞技术团队
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
B
Blog RSS Feed
博客园_首页
Y
Y Combinator Blog
V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
雷峰网
雷峰网
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
H
Help Net Security
P
Proofpoint News Feed
B
Blog
云风的 BLOG
云风的 BLOG
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

博客园 - Loviy.Net

从今天开始博客重新开张啦 [cnforums1.2代码学习]4、关于论坛配置的序列化和反序列化做法 [cnforums1.2代码学习]3、论坛的数据库操作流程 - Loviy.Net - 博客园 [cnforums1.2代码学习]2、关于论坛的页面结构 - Loviy.Net - 博客园 [cnforums1.2代码学习]1、论坛的整体结构 XSL的运算符 XSL学习四 - xsl:choose 学习XSL - xsl:if 学习XSL二 - 学习XSL一 学习委托 SQL常用命令使用方法 Sql Server基本函数 常用SQL语句 WebLogic表格对象 Jsp通过JDBC连接SQL数据库 经典的鱼和水的对白 用样式定义打印1px表格 女孩子的心思真的难以琢磨
客户短保存信息(cookie)
Loviy.Net · 2004-10-22 · via 博客园 - Loviy.Net

由于页面刷新,如何保存客户端信息,想到了cookie

读cookie:

function GetCookie(sName)
{
// cookies are separated by semicolons
//
var aCookie = document.cookie;

for (var i=0; i < aCookie.length; i++)
{
    
// a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    
if (sName == aCrumb[0])
        
return unescape(aCrumb[1]);
       
}
// a cookie with the requested name does not exist
return 1;
}

设置cookie

function SetCookie(sValue)
{
var the_cookie = "switch=" + escape(sValue); 
    document.cookie 
= the_cookie;//写入Cookie 
}

posted on 2004-10-22 08:54  Loviy.Net  阅读(505)  评论(1)    收藏  举报