最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to create an on-screen keyboard which will show which keys are being typed currently? - Stack Overflow

programmeradmin2浏览0评论

I've got an online typing program and I want to create an on-screen keyboard for them, rather like how they do it in typing programs, such as Keyblaze Typing Tutor. So is there a way to create a JavaScript program which will display the keys (the presentation aesthetics don't matter) which are currently being typed by the user?

I've got an online typing program and I want to create an on-screen keyboard for them, rather like how they do it in typing programs, such as Keyblaze Typing Tutor. So is there a way to create a JavaScript program which will display the keys (the presentation aesthetics don't matter) which are currently being typed by the user?

Share Improve this question edited Dec 29, 2015 at 2:05 Zerium asked Apr 6, 2012 at 10:11 ZeriumZerium 17.4k32 gold badges118 silver badges187 bronze badges 1
  • I've been looking online for things like jQuery on Screen Keyboard and similar plugins, but they only allow you to enter text into a textbox, they don't show anything when text is typed using the actual keyboard on your puter. – Zerium Commented Apr 6, 2012 at 10:15
Add a ment  | 

2 Answers 2

Reset to default 5

Try extending this example

jQuery:

$(function () {
  $("#input").keydown(function (event) {
      $("#" + String.fromCharCode(event.which)).addClass("trigger");
  }).keyup(function (event) {
      $("#" + String.fromCharCode(event.which)).removeClass("trigger");
  });
});​

You can create a keyboard using pure HTML and CSS. See this beautiful example

You can find nice jQuery on Screen Keyboard Plugin on this site. Read the documentation too.

It looks like this...

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论