AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
### 返回值:Stringevent.which ### *V1.1.3*概述 针对键盘和鼠标事件,这个属性能确定你到底按的是哪个键或按钮。 event.which 将 event.keyCode 和 event.charCode 标准化了。推荐用 event.which 来监视键盘输入。更多细节请参阅: [event.charCode on the MDC](https://developer.mozilla.org/en/DOM/event.charCode#Notes). ### 示例 #### 描述: 记录按键。 ##### 代码: ~~~ <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.min.js"></script> </head> <body> <input id="whichkey" value="type something"> <div id="log"></div> <script> $('#whichkey').bind('keydown',function(e){ $('#log').html(e.type + ': ' + e.which ); }); </script> </body> </html> ~~~