js中获取event keycode的兼容办法
window.onkeypress=function(e){ var event = e || window.event, //在ff下event会做为参数传进来,ie下会在window下 keyCode = event.which || event.keyCode, //e.which是ff下获取keyCode的方式,ie下使用e.keyCode获取 charCode = event.charCode; }
window.onkeypress=function(e){ var event = e || window.event, //在ff下event会做为参数传进来,ie下会在window下 keyCode = event.which || event.keyCode, //e.which是ff下获取keyCode的方式,ie下使用e.keyCode获取 charCode = event.charCode; }