IE和火狐都支持的方法(输入用户名和密码后按下 enter 键)

在Firefox中老报"event is not defined”错误!原因是因为在Firefox中使用了不同的事件对象模型,不同于IE Dom,用的是W3C Dom。

document.onkeydown=function mykeyDown(e){  
      //compatible IE and firefox because there is not event in firefox  
       e = e||event;  
       if(e.keyCode == 13) {checkData();}   
       return;  
}  

原文地址:https://www.cnblogs.com/zgrft/p/4030320.html