6 noiembrie 2012

A Simple JavaScript Keyboard

See the article about the virtual keyboard with CSS and jQuery. I have been dwelling my own keyboard, not based on lists or divs, which have very simple and tiny code, and very easy to work with. Probably the HTML lists are the best choice in order to build a JavaScript virtual keyboard.

However, I have built my keyboard with tables (why? dunno... In some point, I imagined table rows containing table cells like eggs in their box and I believed it was more suitable. (No way, I had a lot of gotchas with the tables; indeed, the list version, or even a div one would be easier)



The code is not perfect, and not really elegant: because a change in HTML (like adding a new cell), would cause (though not major and not too many) several modifications in the JavaScript code.

Here is the result:


In a new window: virtual keyboard using JavaScript and tables.

The code:
HTML:
CSS:
JavaScript:

Feel free to use this code, modify it, play with it. Comment if have any questions.

Niciun comentariu:

Trimiteți un comentariu