views:

106

answers:

4

i want to make a bbs forum that using much Keyboard event ,

so which is the best Keyboard event library,

thanks

A: 

This one is pretty good for jquery.

http://jshotkeys.googlepages.com/test-static-01.html

Daniel A. White
+1  A: 

Lots of JavaScript libraries come replete with ways of capturing key input and using it to your advantage. It's a good bet that you will be able to find a library to do just that, and nothing else. I don't have a lot of experience there, however.

I've been using Ext for a while now, and their KeyMap class is really easy to work with. Here is a simple example using it.

new Ext.KeyMap(Ext.getDoc(), {
        key: 'abc',
        alt: true,
        handler: function(k, e) {
            var t = Ext.getCmp('tabpanel');
            switch(k) {
                case 65:
                    t.setActiveTab(0);
                    break;
                case 66:
                    t.setActiveTab(1);
                    break;
                case 67:
                    t.setActiveTab(2);
                    break;
            }
        },
        stopEvent: true
    });

This takes class, Ext.TabPanel, and allows the user to push a keyboard key to change tabs, rather than clicking the tabs themselves.

It can, of course, do much more than this. This is a simple example of how it works though.

Stephano
+3  A: 

You can try this one...

http://unixpapa.com/js/key.html

RJ1516
A: 

LivePipe created one with no library dependencies whatsoever. It's pretty nice: http://livepipe.net/extra/hotkey