开发者

keydown event not fired while mouse dragging in Chrome

I noticed a strange behav开发者_如何学运维ior regarding keydown event in Chrome.

I have this simple script (http://jsfiddle.net/xYDbt/1/):

<div id="x"></div>
<script>
    document.onkeydown = function (e)
    {
        document.getElementById("x").innerHTML += "Hi";
    }
</script>

In Chrome, the event is not fired if the mouse is moved around with left click pressed. This happens only the first time after loading the page. Subsequent keypresses work correctly.

I tested this in FF/Opera/IE and it's not a problem.

Is there a workaround for Chrome?


Whilst onkeydown and onkeypress are affected by this bug, it appears onkeyup is not.

Hope you can workaround with that!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜