测试结果:
在ie下:
>> 支持keycode
>> 不支持which和charcode,二者值为 undefined
在firefox下:
>> 支持keycode,除功能键外,其他键值始终为 0
>> 支持which和charcode,二者的值相同
在opera下:
>> 支持keycode和which,二者的值相同
>> 不支持charcode,值为 undefined
请按下任意键看测试效果:
type: 当前key: decimal: keycode: 注:在ff下,keycode始终为0 which: 注:在ie下,which始终为undefined ; 在opera下,keycode和charcode二者的值相同 charcode: 注:在ie、opera下,charcode始终为undefined ; 在ff下,which和charcode二者的值相同 大写: altkey: ctrlkey: shiftkey: repeat:
[ctrl+a 全选 注:如需引入外部js需刷新才能执行]