<! Doctype html> <html> <head> <meta charset = "utf-8"> <title> 按 enter 键触发事件和记住账号密码 </tititle> <cript> // 方法一: // document.onkeypress = function (e) {// var keycode = document.all? }; //} // 方法二: document.onkeypress = viewKeyInfo; function viewKeyInfo (e) {var e = e || evento; if ((e ['keycode'] == 13) || (e ['que'] == 13)) {alert_login ();}} função body_onload () {if (1 == get_saveauth_cookies ()) {var get_user_cookies (); tmp_pwd = get_pwd_cookies (); document.getElementById ("tt_user"). value = tmp_user; document.getElementByIdId ("pd_pwd"). alert_login () {if (document.getElementById ("chx_save_auth"). checked == true) {var cookies_uesr = document.getElementById ("tt_user"). 1440); setCookie ('loginpwd', cookies_pwd, 1440); setcookie ('SAVEAUTH', 1, 1440);} else {setcookie ('saveauth', 0, 1440);} local = "https:/wwwww.bid.bu..} function); cookiestring = nome+'='+escape (valor); if (expireHours> 0) {var date = new Date (); date.setTime (date.gettime ()+expirahours*3600*1000); cookiestring = cookiestring+'; expires = '+date.togmtString (); document.cookie = cookiestring;} document.cookie = cookiestring;} função getcookie (name) {var strcookie = document.cookie; var arrcookie = strcookie.split ('; '); para (var i = 0; arr = arrcookie [i] .split ('='); if (arr [0] == nome) retorna unescape (arr [1]);} return '';} função get_user_cookies () {var tmp_val = getCookie ('loginuser'); getCookie ('loginpwd'); retorna tmp_val;} função get_saveauth_cookies () {var tmp_val = getCookie ('Saveauth'); retorna tmp_val;} </sCript> </head> <corpo = "" Body_onload ")"> <p> Usuário: </invery </spript> </head> <corpo = "" style = "margin-left: 34px; largura: 200px;"/> </p> <p> senha: <input type = "senha" id = "pd_pwd"/> </p> <p> <input type = "caixa de seleção" id = "chx_save_auth"/> salve </p> <p> <p> <p> <brox "iD =" chx_save_auth "/> value = "login"/> </p> <!-<input type = "button" onclick = "javascript: alert_login ()" value = "login"/> javascript: alert_login () 与 alert_login () 无区别-> </body> </html>以上这篇 JS 实现登录页面记住密码和 Digite 键登录方法推荐就是小编分享给大家的全部内容了 , 希望能给大家一个参考 , 也希望大家多多支持武林网。