html5 localStorage 保存登录信息
1 //保存缓存 2 function saveStorage(){ 3 var name= document.getElementById("name").value; 4 localStorage.setItem("name",name); 5 var password = document.getElementById("password").value; 6 localStorage.setItem("password",password); 7 8 } 9 10 $(document).ready(function(){ 11 //读取 localStage 本地存储,填充用户名密码,如果自动登录有值直接跳转; 12 var storage = window.localStorage; 13 var name= storage["name"]; 14 var password= storage["password"]; 15 });