JS操作Cookie写入和读取实例代码
时间:2024-04-22 13:07:30
写入cookie实例!
var u = "value=123";
document.cookie = u;
读取cookie实例,读取value的值!
var c_name="value"; // 变量名
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=")
if (c_start != -1) {
c_start = c_start + c_name.length + 1
c_end = document.cookie.indexOf(";", c_start)
if (c_end == -1) c_end = document.cookie.length
// document.write(document.cookie.substring(c_start,c_end)+"<br>");
var sss= unescape(document.cookie.substring(c_start, c_end)) // 取出值
alert(sss)
}
}
标签:JS操作Cookie,写入读取
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python破解WiFi教程代码,Python蹭网原理讲解
2022-09-05 20:14:43
python读取.data文件的实现
2021-10-28 06:24:05
![](https://img.aspxhome.com/file/2023/8/125208_0s.png)
Python基于SMTP协议实现发送邮件功能详解
2022-07-17 00:31:00
![](https://img.aspxhome.com/file/2023/8/72838_0s.png)
Python内存泄漏和内存溢出的解决方案
2022-02-10 11:46:55
Python文件处理
2022-08-08 10:22:01
Dreamweaver快速编辑网页标签
2009-05-29 18:35:00
![](https://img.aspxhome.com/file/UploadPic/20072/200723113549405s.jpg)
mysql的存储过程、游标 、事务实例详解
2024-01-12 22:02:15
详解python3 + Scrapy爬虫学习之创建项目
2022-07-22 18:02:05
![](https://img.aspxhome.com/file/2023/2/109592_0s.png)
Vue2.0利用 v-model 实现组件props双向绑定的优美解决方案
2024-05-02 17:09:28
ORACLE中dbms_output.put_line输出问题的解决过程
2024-01-15 04:10:30
![](https://img.aspxhome.com/file/2023/0/64860_0s.png)
Python为何不支持switch语句原理详解
2023-03-27 08:37:27
![](https://img.aspxhome.com/file/2023/9/121749_0s.jpg)
python shutil操作文件实例讲解
2022-05-20 06:42:08
使用python进行nc转tif的3种情况解决
2022-05-09 11:22:43
![](https://img.aspxhome.com/file/2023/1/109911_0s.png)
Ubuntu 18.04安装mysql 5.7.23
2024-01-28 19:44:13
![](https://img.aspxhome.com/file/2023/7/124077_0s.jpg)
Python字典深浅拷贝与循环方式方法详解
2022-08-04 08:52:25
![](https://img.aspxhome.com/file/2023/7/71317_0s.png)
QQ在线客服网页代码大全
2008-01-17 18:28:00
![](https://img.aspxhome.com/file/UploadPic/20081/17/2008117205323775s.gif)
CSS3的五个使用技巧[译]
2009-02-19 13:01:00
![](https://img.aspxhome.com/file/UploadPic/20092/19/01-92s.jpg)
python3使用SMTP发送简单文本邮件
2023-09-28 10:07:24
![](https://img.aspxhome.com/file/2023/0/109430_0s.jpg)
python reverse反转部分数组的实例
2021-09-16 05:30:11
css reset中的list-style:none
2010-05-26 13:56:00
![](https://img.aspxhome.com/file/UploadPic/20105/26/01-62s.jpg)