手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >onkeypress字符按键兼容所有浏览器使用介绍
onkeypress字符按键兼容所有浏览器使用介绍
摘要:复制代码代码如下:document.onkeypress=function(e){alert(getCharCode(e));};funct...

复制代码 代码如下:

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字符按键兼容所有浏览器使用介绍】相关文章:

两边静止的广告条

文本框栏目介绍

详解Node.js包的工程目录与NPM包管理器的使用

Jquery中基本选择器用法实例详解

angular2使用简单介绍

微信内置浏览器私有接口WeixinJSBridge介绍

javascript动态设置样式style实例分析

JQuery中基础过滤选择器用法

JS中字符串trim()使用示例

Javascript 高阶函数使用介绍

精品推荐
分类导航