HTML5基础20----Web Storage概述
来源:互联网 发布:网络投票怎么刷票 编辑:程序博客网 时间:2024/05/22 07:01
<!DOCTYPE html><!--Web Storage概述--><html><head lang="en"> <meta charset="UTF-8"> <title></title> <script src="appWeb20.js"></script></head><body>Web Storage功能就是在Web上储存数据的功能,这里的储存是针对客户端本地而言的。具体分两种:sessionStorage和localStorage。sessionStorage打开浏览器存储,关闭浏览器存储的就没了localStorage存储在硬盘等,永久存储具体下面实现一下:<p id="msg"></p><input type="text" id="input"><input type="button" value="保存数据" onclick="saveSessionStorage('input')"><input type="button" value="读取数据" onclick="readSessionStorage('msg')"></body></html>
/** * Created by renchong on 2015/7/25. *///sessionStorage打开浏览器存储,关闭浏览器存储的就没了//保存数据//function saveSessionStorage(id){// var taget=document.getElementById(id);// var str=taget.value;//// 保存数据的方法 key value// sessionStorage.setItem("message",str);//}//////读取数据//function readSessionStorage(id){// var taget=document.getElementById(id);// //读取数据// var mag=sessionStorage.getItem("message");// taget.innerHTML=mag;////}//localStorage存储在硬盘等,永久存储//保存数据function saveSessionStorage(id){ var taget=document.getElementById(id); var str=taget.value;// 保存数据的方法 key value localStorage.setItem("message",str);}//读取数据function readSessionStorage(id){ var taget=document.getElementById(id); //读取数据 var mag=localStorage.getItem("message"); taget.innerHTML=mag;}
0 0
- HTML5基础20----Web Storage概述
- HTML5基础(Web Storage)
- Html5的Web Storage的基础
- 【HTML5与CSS3基础】HTML5本地存储 Web Storage
- 转HTML5 web storage
- HTML5 Web Storage 特性
- HTML5之WEB Storage
- HTML5 Web Storage 特性
- HTML5 Web Storage用法
- HTML5 Web Storage 特性
- HTML5 Web Storage
- HTML5 Web Storage代码
- HTML5开发 web storage
- HTML5的Web Storage
- HTML5 Web Storage
- html5 Web storage
- html5 web storage 存储
- HTML5 Web Storage
- VS2015开发安卓应用笔记(一)
- Cube Simulation zoj3429 模拟
- 二维费用背包
- 2.1 Qemu用户态 Machine与cpu管理
- Oracle OLAP 与 OLTP 介绍
- HTML5基础20----Web Storage概述
- error C2660: “Gdiplus::GdiplusBase::operator new”: 函数不接受 3 个参数(转)
- INT_MAX,INT_MIN,isdigit函数
- matlab cosd,cos,acos,acosd
- MySQL架构方案
- 将tomcat添加为 linux service 服务
- 进程管理(3-3)
- 获取美版的google play store
- 字典树简介