首页 > 代码库 > Keypress - 捕获键盘输入的JavaScript库
Keypress - 捕获键盘输入的JavaScript库
Keypress 是一个强大的 JavaScript 库,用于捕获键盘输入。这是一个有非常特殊的功能的输入捕获库,它是很容易掌握和使用,并且不依赖第三方库。在网站开发中,经常会碰到需要处理键盘输入的场景,处理起来繁琐。现在有了这个键盘输入处理的库就很方便了。
使用示例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | keypress.combo( "shift s" , function () { console.log( "You pressed shift and s" ); }); // There are also a few other shortcut methods: // If we want to register a counting combo keypress.counting_combo( "tab space" , function (e, count) { console.log( "You‘ve pressed this " + count + " times." ); }); // If you want to register a sequence combo keypress.sequence_combo( "up up down down left right left right b a enter" , function () { lives = 30; }, true ); |
立即下载 效果演示
<iframe id="google_ads_frame2" vspace="0" height="250" marginHeight="0" src="http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-3447371224873639&output=html&h=250&slotname=8660799060&adk=1970350646&w=300&lmt=1400240713&flash=0&url=http%3A%2F%2Fwww.cnblogs.com%2Fxiaochao12345%2Fp%2F3730049.html&dt=1400240713679&shv=r20140513&cbv=r20140417&saldr=sb&correlator=1400240713478&frm=20&ga_vid=227879072.1400240514&ga_sid=1400240514&ga_hid=377090119&ga_fc=1&u_tz=480&u_his=95&u_java=1&u_h=768&u_w=1364&u_ah=740&u_aw=1364&u_cd=16&u_nplug=0&u_nmime=0&dff=verdana&dfs=12&adx=0&ady=0&biw=314&bih=74&eid=317150304&oid=3&rx=0&eae=0&docm=9&vis=0&fu=0&ifi=2&xpc=WdJUQ8x6zL&p=http%3A//www.cnblogs.com&dtd=48" frameBorder="0" width="300" allowTransparency="true" name="google_ads_frame2" marginWidth="0" scrolling="no" hspace="0"></iframe><iframe id="google_ads_frame3" vspace="0" height="250" marginHeight="0" src="http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-3447371224873639&output=html&h=250&slotname=8660799060&adk=1970350646&w=300&lmt=1400240713&flash=0&url=http%3A%2F%2Fwww.cnblogs.com%2Fxiaochao12345%2Fp%2F3730049.html&dt=1400240713734&shv=r20140513&cbv=r20140417&saldr=sb&prev_slotnames=8660799060&correlator=1400240713478&frm=20&ga_vid=227879072.1400240514&ga_sid=1400240514&ga_hid=377090119&ga_fc=1&u_tz=480&u_his=95&u_java=1&u_h=768&u_w=1364&u_ah=740&u_aw=1364&u_cd=16&u_nplug=0&u_nmime=0&dff=verdana&dfs=12&adx=304&ady=250&biw=314&bih=74&eid=317150304&oid=3&rx=0&eae=0&docm=9&vis=0&fu=0&ifi=3&xpc=I9xXxjto01&p=http%3A//www.cnblogs.com&dtd=42" frameBorder="0" width="300" allowTransparency="true" name="google_ads_frame3" marginWidth="0" scrolling="no" hspace="0"></iframe>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。