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

推荐订阅源

V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
L
LangChain Blog
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
Y
Y Combinator Blog
月光博客
月光博客
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
小众软件
小众软件
H
Help Net Security
Last Week in AI
Last Week in AI
B
Blog RSS Feed
宝玉的分享
宝玉的分享
N
Netflix TechBlog - Medium
博客园 - 叶小钗
The GitHub Blog
The GitHub Blog

博客园 - 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)    收藏  举报