可以参考这篇博文
http://www.heiniuhaha.cn/blog/?p=578
http://www.heiniuhaha.cn/blog/?p=578
function keydown(e) {
var currKey=0,e=e||event;
currKey=e.keyCode||e.which||e.charCode;//支持IE、FF
if (currKey == 13) {
document.getElementById("btn_selector").click();
}
}
document.onkeydown = keydown;//onkeydown事件调用方式