input框触发回车事件

window.event只能在IE下运行,不能在firefox下运行,这是因为firefox的event只能在事件发生的现场使用。   
在firefox里直接调用event对象会报undefined。

*firefox需要传递event对象,书写必须为event

<input type="text" onkeydown="keyup_submit(event);">

<script>
function keyup_submit(e){ 
 var evt = window.event || e; 
  if (evt.keyCode == 13){
    //回车事件
  }
}
</script>

原文:https://www.cnblogs.com/houweijian/p/5808978.html