document.onkeypress = function( e ){
alert( getCharCode( e ) );
};
function getCharCode( e ){
var e = e || window.event;
if( typeof e.charCode == "number" ){
return e.charCode;
}else{
return e.keyCode;
};
};
使用onkeypress字符按键兼容所有浏览器
最新推荐文章于 2021-07-21 16:42:58 发布