当得到键盘事件时,判断是IE还是Firefox: οnkeypress="return fnCheckNumber(event)" function fnCheckNumber(event){ //判断是IE还是firefox event = event?event:(window.event?window.event:""); var key = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; }