document.onkeydown = function(e) { var lKeyCode = e || window.event; if (lKeyCode.keyCode == 13) { btnSearch(); } }