sisibest

导航

只能输入数字

 <script type="text/javascript" language="javascript">
        function myKeyDown() {
            var k = window.event.keyCode;

            if ((k == 46) || (k == 8) || (k == 189) || (k == 109) || (k == 190) || (k == 110) || (k >= 48 && k <= 57) || (k >= 96 && k <= 105) || (k >= 37 && k <= 40))
            { }
            else if (k == 13) {
                window.event.keyCode = 9;
            }
            else {
                window.event.returnValue = false;
            }
        }

    </script>

 

Style="ime-mode: disabled" onkeydown="myKeyDown()"

posted on 2013-01-31 16:59  sisibest  阅读(124)  评论(0编辑  收藏  举报