方法名称 |
说明 |
|
|
|
.setItem(name,value) |
|
|
|
|
.getItem(name) |
|
|
|
|
.removeItem(name) |
|
|
|
|
.clear() |
|
|
|
|
.length |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
示例
var storage=window.localStorage;
storage["a"]=1;
storage.setItem("c",3);
console.logstorage.a);
//第二种方法读取
console.log(storage["b"]);
//第三种方法读取
console.log(storage.getItem("c"));