• 怎样验证TextBox输入的全是数字 .NET技术 / ASP.NET


    方法1:
                function   InputNumb()
                {
    //                debugger;
                    if(   window.event.keyCode==37)//可输入Tab
                        return;
                    if(   window.event.keyCode==37   &&   window.event.keyCode==39)//可输入左右方向
                        return;
                    if(   window.event.keyCode==8   &&   window.event.keyCode==46)//可输入backspace   del
                        return;
                    if(   window.event.keyCode> =96   &&   window.event.keyCode <=105   )//可输入键盘上的数子
                        return;
                    if(   window.event.keyCode> =48   ||   window.event.keyCode <=57   )//过滤掉非数字的其他键
                        return;
                    window.event.returnValue   =   false;
                    return;
                }
     
    方法2:
    if(   window.event.keyCode <48   ||   window.event.keyCode> 57   )
    {
        window.event.returnValue   =   false;
        return;
    }
    贴子来源飞诺网(http://bbs.firnow.com) 详细出处参考:http://bbs.firnow.com/dview1t123996.html
  • 相关阅读:
    使用PDO连接数据库
    ES6 promise
    弹框小三角
    封装弹窗功能
    css3 省略号
    使mac支持NTFS读写问题
    Vue 打包 build 前需要修改哪些配置和路径
    eslint配置大全
    在elementUI中使用 el-autocomplete 实现远程搜索的下拉框
    element-UI table自定义表头
  • 原文地址:https://www.cnblogs.com/wuhuisheng/p/2023268.html
Copyright © 2020-2023  润新知