javascript 获取按的哪个键
<input onKeyDown="checkKey(event)" name="SearchData" type="text">
<script language="JavaScript" type="text/javascript">
function checkKey(evt) {
var evt = evt ? evt : (window.event ? window.event : null); //区分IE和FF来得到event
var code = evt.which ? evt.which :evt.keyCode; //区分IE和FF来得到 event.keyCode 或 event.which
alert(code);
}
</script>