onkeypress字符按键兼容所有浏览器使用介绍_javascript技巧: 代码如下: document.onkeypress = function( e ){ alert( getCharCode( e ) ); }; function getCharCode( e ){ var e = e window.event; if( typeof e.charCode == number ){ return e.char
导读onkeypress字符按键兼容所有浏览器使用介绍_javascript技巧: 代码如下: document.onkeypress = function( e ){ alert( getCharCode( e ) ); }; function getCharCode( e ){ var e = e window.event; if( typeof e.charCode == number ){ return e.char
代码如下: 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字符按键兼容所有浏览器使用介绍_javascript技巧
onkeypress字符按键兼容所有浏览器使用介绍_javascript技巧: 代码如下: document.onkeypress = function( e ){ alert( getCharCode( e ) ); }; function getCharCode( e ){ var e = e window.event; if( typeof e.charCode == number ){ return e.char