Monday, March 30, 2009

[jQuery] Re: a keydown problem? :)

i've lifted this from something i wrote t'other day which was working
in ie7...

$(document).keypress(function(e){
var key;
if (!e)
e = window.event
if ((!e.charCode)|(e.charCode == 0)) {
key = e.keyCode
} else {
key = e.charCode
}

/* put stuff here! */

});

give it a go. it has lots of magical little quirks which can make
keypress/down/up stuff a royal pain in the arse.

a good reference (which may not be much use to your issue) is
http://www.quirksmode.org/js/keys.html

On Mar 30, 8:45 am, liec <lie...@gmail.com> wrote:
> $(window).keydown(function(e){
>         if (e.keyCode == 13)
>                 sendmsg();
>
> });
>
> It works well on firefox and chrome
> but It is not work on IE7.0 ?

No comments: