//全局:
$(function () {
document.onkeydown = function (e) {
var ev = document.all ? window.event : e;
if (ev.keyCode == 13) {
$("#FormId").submit();
}
}
});
//某个控件:
$(‘#id‘).keydown(function (e) {
if (e.keyCode == 13) {
$("#FormId").submit();
}
});
//取消回车键
if (window.event.keyCode == 13) {
window.event.keyCode = 0;
}
//将回车模拟成Tab键
if (window.event.keyCode == 13) {
window.event.keyCode = 9
}
时间: 2024-11-07 22:41:54