zl程序教程

您现在的位置是:首页 >  后端

当前栏目

onkeypress字符按键兼容所有浏览器使用介绍

字符浏览器 使用 介绍 所有 兼容 按键
2023-06-13 09:14:51 时间
复制代码代码如下:

document.onkeypress=function(e){
alert(getCharCode(e));
};
functiongetCharCode(e){
vare=e||window.event;
if(typeofe.charCode=="number"){
returne.charCode;
}else{
returne.keyCode;
};
};