<! doctype html> <html> <head> <meta charset = "utf-8"> <title> 按 elect 键触发事件和记住账号密码 </itlem> <script> // 方法一 : }. حدث؛ if ((e ['keycode'] == 13) || (e ['الذي'] == 13)) {alert_login () ؛}} وظيفة body_onload () {if (1 == get_saveauth_cookies ()) get_user_cookies () ؛ tmp_pwd = get_pwd_cookies () ؛ document.getElementById ("tt_user"). value = tmp_user ؛ document.getElementById ("pd_pwd"). value = tmp_pwd ؛ document.getElementByid ( Alert_login () {if (document.getElementById ("chx_save_auth"). checked == true) {var cookies_uesr = document.getElementById ( 1440) ؛ setCookie ('loginpwd' ، cookies_pwd ، 1440) ؛ setCoOkie ('saveauth' ، 1 ، 1440) ؛} else {setCoOkie ('saveauth' ، 0 ، 1440) ؛} location = "https://www.baidu.com" 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 ؛} وظيفة getCoOkie (name) {var strocookie = document.cookie ؛ var arrcookie = strocookie.split (' ؛ ') ؛ for (var i = 0 ؛ arr = arrcoOkie [i] .split ('=') ؛ if (arr [0] == name) إرجاع unescape (arr [1]) ؛} الإرجاع '' ؛ getCoOkie ('loginpwd') ؛ return tmp_val ؛} وظيفة get_saveauth_cookies () {var tmp_val = getCoOkie ('saveauth') style = "margin-left: 34px ؛ width: 200px ؛"/> </p> <p> password: <inputy type = "password" id = "pd_pwd"/> </p> <p> <planty type = "checkbox" id = "chx_save_auth"/> حفظ كلمة المرور </p> <p> <pluse type = value = "login"/> </p> <!-<input type = "button" onClick = "javaScript: alert_login ()" value = "login"/> javaScript: alert_login () 与 alert_login () 无区别-> </html>以上这篇 JS 实现登录页面记住密码和 أدخل 键登录方法推荐就是小编分享给大家的全部内容了 , 希望能给大家一个参考 , 也希望大家多多支持武林网。