sisibest

导航

只能输入数字

 <script type="text/javascript" language="javascript">
        $(function() {
            //数量只能输入数字
            $("#<%=txtQuantity.ClientID %>").keydown(function(event) {
                var keyCode = event.which;
                if (keyCode == 8 || (keyCode >= 48 && keyCode <= 57) || keyCode == 37 || keyCode == 39 || (keyCode >= 96 && keyCode <= 105)) {
                    return true;
                } else {
                    return false;
                }
            }).focus(function() {
                this.style.imeMode = 'disabled';
            });
        });
    </script>

posted on 2013-01-07 16:40  sisibest  阅读(123)  评论(0编辑  收藏  举报