<script type="text/javascript">
document.onkeydown=keyDownSearch;
function keyDownSearch(e) {
// 兼容FF和IE和Opera
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
getTableListData();//具体处理函数
return false;
}
return true;
}
</script>
如果想监听其他按键事件,可以将e.KeyCode打印出来,看具体的键对应的编码。其他按键事件同样可以使用该方法来监听。