Here is an example in: <a href="http://www.devx.com/webdev/10MinuteSolution/27134/0/page/3" rel="nofollow">http://www.devx.com/webdev/10MinuteSolution/27134/0/page/3</a><p>Most likely, if you are using a JS library, they already have some easy tools to do this through the library. I use YUI, and here it is for that library: <a href="http://developer.yahoo.com/yui/examples/container/keylistener.html" rel="nofollow">http://developer.yahoo.com/yui/examples/container/keylistene...</a>