经验证这种方法,对IE和firefox都适用: $(document).keypress(function(e){ // 回车键事件 if (e.which == 13) { login();//调用登录方法 } });