The following small series will bring you a JS login page to remember the password and enter key login method recommended. I think it is quite good. Now I will share it with you and give you a reference.
Press enter to trigger the event and remember the account passwordScript // Method 1: // document. onkeypress = function (e) {// var keycode = document. all? Event. keyCode: e. which; // if (keycode = 13) {// alert_login (); //}; // Method 2: document. onkeypress = viewKeyInfo; function viewKeyInfo (e) {var e = e | event; if (e ['keycode'] = 13) | (e ['which '] = 13) {alert_login () ;}} function body_onload () {if (1 = get_saveauth_cookies ()) {var tmp_user = ''; var tmp_pwd =''; tmp_user = get_user_cookies (); tmp_pwd = get_pwd_cookies (); document. getElementById ("tt_user "). value = tmp_user; document. getElementById ("pd_pwd "). value = tmp_pwd; document. getElementById ("chx_save_auth "). checked = true ;}} function alert_login () {if (document. getElementById ("chx_save_auth "). checked = true) {var cookies_uesr = document. getElementById ("tt_user "). value; var cookies_pwd = document. getElementById ("pd_pwd "). value; setcookie ('loginuser', cookies_uesr, 1440); setcookie ('loginpwd', cookies_pwd, 1440); setcookie ('saveauth', 1, 1440 );} else {setcookie ('saveauth ', 0, 1440);} location =" https://www.baidu.com ";} Function setcookie (name, value, expirehours) {var cookieString = name + '=' + escape (value); if (expirehours> 0) {var date = new Date (); date. setTime (date. getTime () + expirehours * 3600*1000); cookieString = cookieString + '; expires =' + date. toGMTString (); document. cookie = cookieString;} document. cookie = cookieString;} function getcookie (name) {var strCookie = document. cookie; var arrCookie = strCookie. split (';'); for (var I = 0; IUser:
Password:
Save password
The above JS implementation login page remembers the password and enter key login method recommended is all the content shared to you by xiaobian, hope to give you a reference, also hope you can support more.