html5 web database
时间:2021-07-01 10:21:17
帮助过:2人阅读
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title
</title>
<script type="text/javascript">
/* if(window.localStorage){
alert(‘支持‘);
}else{
alert(‘浏览器不支持localStorage‘);
}*/
// localStorage.setItem(‘t3‘,‘12345‘); //设置值
// document.write(localStorage.t1); //获取值
// document.write(localStorage.length); // 查存储个数
// document.write(localStorage.getItem(‘t1‘)); //取值
// document.write(localStorage.getItem(localStorage.key(0))); //取第1个值
localStorage.removeItem("t1"); //删除
// localStorage.clear(); // 清除所有
for(var i = 0; i<localStorage.length;i++){
document.write(localStorage.key(i)+": "+localStorage.getItem(localStorage.key(i))+"<br/>");
}
</script>
</head>
<body>
localStorage 本地存储 关闭浏览器后数据还存在
</body>
</html>
html5 web database
标签: