开发者

How to stop key event in android honeycomb browser?

开发者 https://www.devze.com 2023-04-12 11:38 出处:网络
I want to stop key event at html input. So I use preventDefault() to stop keyEvent. And it works fine at otherBrowser (iOS, Chrome, Android2.3).

I want to stop key event at html input.

So I use preventDefault() to stop keyEvent.

And it works fine at otherBrowser (iOS, Chrome, Android2.3).

But it doesn't work in Android 3.0 (Honeycomb)

This is my test sample.

<html>
    <head>
        <title></title>
        <script type="text/javascript">
            function start( e ) {
            var input1 = document.getElementById("input1");
            input1.addEventListener("keydown开发者_如何学运维",keydown,false);
            input1.addEventListener("keypress",keypress,false);
            input1.addEventListener("keyup",keyup,false);

            }
            function keydown( e ) {
            e.preventDefault();
            e.returnValue = false;
            return false;
            }

            function keypress( e ) {
            e.preventDefault();
            e.returnValue = false;
            return false;
            }

            function keyup( e ) {
            e.preventDefault();
            e.returnValue = false;
            return false;
            }
            window.onload= start;
    </script>
    </head>
    <body>
        <input id="input1"></input>
    </body>
</html>

Is there something wrong in my testSample?

0

精彩评论

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

关注公众号