jquery 记住账号 记住密码

 1  <body>
 2  <label><input    type="checkbox" onclick="loginBtn_user()" /><span>记住账号</span></label>
 3  <label><input  type="checkbox"  onclick="loginBtn_pass()" /><span>记住密码</span></label>
 4 </body
 5 
 6 <script>
 7  //记住账号
 8     function loginBtn_user(){
 9         var username = $('.username').val();
10         localStorage.setItem('username',username);
11     }
12 
13     //记住密码
14     function loginBtn_pass(){
15         var password = $('.password').val();
16         localStorage.setItem('password',password);
17     }
18 //记住的赋值
19     var user=localStorage.getItem("username");
20     var pass=localStorage.getItem("password");
21     $('.username').val(user)
22     $('.password').val(pass)
23 
24 </script>

 

posted @ 2017-12-12 17:36  原来是个帅小伙  阅读(237)  评论(0编辑  收藏  举报