COOKIE
//设置到kookie function setCookie(name,value) { var Days = 10;//cookie时间 var exp = new Date();//当前时间 exp.setTime(exp.getTime() + Days*24*60*60*1000);//失效时间 document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); } //读取cookies function getCookie(name) { var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)) return unescape(arr[2]); else return null; } //删除cookie function delCookie(name) { var exp = new Date(); exp.setTime(exp.getTime() - 1); var cval=getCookie(name); if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString(); } function login_checkKeydown(){ if(event.keyCode == 13){//回车键 login(); } } <body οnkeydοwn="login_checkKeydown()">