HTML5中的storage存储
来源:互联网 发布:房天下 源码 编辑:程序博客网 时间:2024/04/30 14:49
1.个人标示
caicongyang:http://blog.csdn.net/caicongyang
2.代码:
<!DOCTYPE html><html> <head> <title>storageHtml.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> </head> <body> This is my storageHtml page. <br> </body> <script type="text/javascript"> if(window.localStorage){ alert("您的浏览器支持本地存储!"); //支持键值对的形式-设置键值对 localStorage.setItem("name","张三"); //键值对长度 alert(localStorage.length); //获取键值对的值 alert(localStorage.getItem("name")); //通过索引获取键值对的值 alert(localStorage.key(0)); //移除某个键值对 localStorage.removeItem("name"); //清除所有的键值对 localStorage.clear(); alert(localStorage.length); //localStorage同样支持josn格式的数据对象 var user = { name:"李四", age:"15" }; localStorage.setItem("u1",JSON.stringify(user)); var u = JSON.parse(localStorage.getItem("u1")); alert(u.name); } if(window.sessionStorage){ alert("您的浏览器支持会话存储!"); //sessionStorage的方法与localStorage相同 } //本地存储数据监听 window.onload = function(){ window.addEventListener("storage",function(e){ console.log(e); },true); }; </script></html>
3.我的博客
http://blog.csdn.net/caicongyang
1 0
- HTML5中的storage存储
- html5 web storage 存储
- html5 storage数据存储
- html5 中的 wbe storage
- HTML5本地存储-Web Storage
- HTML5 Web Storage 存储介绍
- HTML5--本地存储Web Storage
- HTML5 Local Storage 本地存储
- HTML5 网页存储 Web Storage
- HTML5 Local Storage 本地存储
- HTML5 本地存储Web Storage
- html5本地存储web storage
- HTML5--本地存储Web Storage
- html5中的Web Storage包括了两种存储方式:sessionStorage和localStorage。
- HTML5----Web Storage存储web数据
- HTML5开发 Local Storage 本地存储
- Html5 系列之:本地存储Storage
- HTML5本地存储之Web Storage篇
- 进程和线程
- python3爬虫问题 POST data should be bytes or an iterable of bytes
- 最大K乘积问题
- 美团点评融资之际与阿里矛盾升级
- Map KeySet方法
- HTML5中的storage存储
- Hbuilder--让手爽,飞一般的编码
- 数组变MaxTree-java
- 3个月零基础入门数据分析师是一件完全可能的事!
- JavaScript用法详解
- sqlserver进程死锁的解决办法(一)
- iOS UICollectionView简介 —— HERO博客
- win7 局域网 svn服务器搭建
- log4j MDC NDC