开发者

Mapping keystrokes to actual value? - Javascript

any cool libraries that you know about around? 开发者_如何学Python=)


Hard to tell exactly what you're asking, but if you're handling an event that gives you a charCode, such as keypress, you can use

var str = String.fromCharCode(event.charCode);

// or
var str = String.fromCharCode(event.which);

to get the value of the key that was pressed.

https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/String/fromCharCode


This jquery event.which example pretty much does what you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜