标签:xiaomi utf-8 json min asc tor html cal head
!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
<script type="text/javascript">
// 使用sessitonStrolage进行存储
// 保存
sessionStorage.setItem(‘key1‘, ‘value1‘);
sessionStorage.setItem(‘key2‘, JSON.stringify([1, 2, 3, 4]));
sessionStorage.setItem(‘key3‘, JSON.stringify({ name: "xiaoming" }));
// 取出
var value = sessionStorage.getItem(‘key3‘);
console.log(value);
// 删除
// sessionStorage.removeItem(‘key2‘);
// 清除
sessionStorage.clear();
localStorage.setItem(‘key1‘, ‘value1‘);
var v=localStorage.getItem(‘key1‘)
console.log(v)
</script>
</html>
标签:xiaomi utf-8 json min asc tor html cal head
原文地址:http://www.cnblogs.com/csw1364115877/p/6115567.html