zoukankan      html  css  js  c++  java
  • Text box to accept only number

    head  runat="server">

        <title></title>

        <script language="javascript" type="text/javascript">

            function CheckNumeric(e) { 

                if (window.event) // IE

                {

                    if ((e.keyCode < 48 || e.keyCode > 57) & e.keyCode != 8) {

                        event.returnValue = false;

                        return false; 

                    }

                }

                else { // Fire Fox

                    if ((e.which < 48 || e.which > 57) & e.which != 8) {

                        e.preventDefault();

                        return false;

                     }

                }

            }    

        </script>

    </head>

    <body>

        <form id="form1" runat="server">

        <asp:textbox id="TextBox1" runat="server" onkeypress="CheckNumeric(event);"

                 xmlns:asp="#unknown"></asp:textbox>

        </form>

    </body></head>

    http://www.codeproject.com/Tips/306192/Text-box-to-accept-only-number

  • 相关阅读:
    无线桥接(WDS)如何设置?
    Linux内核的整体架构简介
    Efuse--芯片存储
    Linux下编写和加载 .ko 文件(驱动模块文件)
    统计难题
    最少拦截系统
    (比赛)B
    (比赛)A
    F
    K
  • 原文地址:https://www.cnblogs.com/nuaaydh/p/4313181.html
Copyright © 2011-2022 走看看