方法一:
document.onkeydown = function (e) { // 回车提交表单
// 兼容FF和IE和Opera
var theEvent = window.event || e;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
queryInfo();
}
}

方法二:
JS监听某个DIV区域
$("#queryTable").bind("keydown",function(e){
  // 兼容FF和IE和Opera
  var theEvent = e || window.event;
  var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
   if (code == 13) {
  //回车执行查询
  $("#queryButton").click();
  }
});
JS监听某个输入框
//回车事件绑定
$('#search_input').bind('keyup', function(event) {
  if (event.keyCode == "13") {
    //回车执行查询
    $('#search_button').click();
  }
});

相关文章:

  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
猜你喜欢
  • 2021-07-05
  • 2022-12-23
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案