Javascript登录页面“记住密码”实现
JS记住密码实现效果:
JavaScript Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <!DOCTYPE html> <html> <head> <title>用户名密码</title> <script type= “text/javascript” src= “http://ajax.microsoft.com/ajax/jquery/jquery-1.4.min.js“ ></script> <script> function SavePassword() { if (document.getElementById( “savePassword” ).checked) { var username = $( “#username” ).val(); var password = $( “#password” ).val(); window.sessionStorage.username = username; window.sessionStorage.password = password; localStorage.rmbPassword = true ; } else { localStorage.rmbPassword = false ; } } </script> </head> <body> <label id= “login” for = “username” style= “margin:auto;font-size:15px” >用户名:</label> <input style= “margin:auto;font-size:15px” type= “text” name= “username” id= “username” placeholder= “输入用户名…” > <br><br> <label id= “login” for = “password” style= “margin:auto;font-size:15px” >密   码:</label> <input style= “margin:auto;font-size:15px” type= “password” name= “password” id= “password” placeholder= “输入密码…” > <input type= “checkbox” name= “savePassword” id= “savePassword” checked= “checked” οnclick= “SavePassword()” > </body> </html> |
转载于//www.cnblogs.com/MakeView660/p/7798489.html
还没有评论,来说两句吧...