回车键搜索兼容性问题

回车键搜索兼容性问题

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) { return false; } return true; }

原文地址:https://www.cnblogs.com/earnest/p/6607305.html