Javascript 本地存储列表键
我想知道如何做的关键是像:1,2,3。。。 现在,这是我的代码:Javascript 本地存储列表键,javascript,jquery,html,storage,local,Javascript,Jquery,Html,Storage,Local,我想知道如何做的关键是像:1,2,3。。。 现在,这是我的代码: <input type='text' id='provedor' /> <input type='text' id='login' /> <input type='text' id='senha' /> <input type='text' id='link' /> <input type='text' id='id' /> <button onclick=
<input type='text' id='provedor' />
<input type='text' id='login' />
<input type='text' id='senha' />
<input type='text' id='link' />
<input type='text' id='id' />
<button onclick="save()" type="button">Save</button>
<script>function save(){
var json = {};
json.login = $('#login').val();
json.senha = $('#senha').val();
json.link = $('#link').val();
json.id = $('#id').val();
var provedor = document.getElementById('provedor').value;
localStorage.setItem(provedor, JSON.stringify(json));}
拯救
函数save(){
var json={};
json.login=$('#login').val();
json.senha=$('#senha').val();
json.link=$('#link').val();
json.id=$('#id').val();
var provedor=document.getElementById('provedor').value;
localStorage.setItem(provedor,JSON.stringify(JSON));}
我需要这个来列出结果。请帮帮我。非常感谢 如果希望所有键和结果都来自本地存储:
localStorage.setItem("a", 1);
localStorage.setItem("b", 1);
localStorage.setItem("c", 1);
localStorage.setItem("d", 1);
var store = [];
for (var i = 0; i < localStorage.length; i++)
{
store.push([localStorage.key(i), localStorage.getItem(localStorage.key(i))]);
}
console.log(JSON.stringify(store));
localStorage.setItem(“a”,1);
setItem(“b”,1);
setItem(“c”,1);
localStorage.setItem(“d”,1);
var存储=[];
for(var i=0;i
你必须更清楚自己想做什么。