How To validate numeric Textbox using Javascript in ASp.net


HTML / XML
 <script src="jquery-1.6.4.js" type="text/javascript"></script>

    <script type="text/javascript">
    function maskInput() {
    var key_code = window.event.keyCode;
    var oElement = window.event.srcElement;
    if (!window.event.shiftKey && !window.event.ctrlKey && !window.event.altKey) {
        if ((key_code > 47 && key_code < 58) ||
            (key_code > 95 && key_code < 106)) {

            if (key_code > 95)
                 key_code -= (95-47);
            oElement.value = oElement.value;
        } else if(key_code == 8) {
            oElement.value = oElement.value;
        } else if(key_code != 9) {
            event.returnValue = false;
        }
    }
}
(document).ready(function() {
    $('#myTextbox').keydown(maskInput);
});
    </script>

Design page for Textbox numeric validation using Javascript and Jquery.

HTML / XML
 <div>
        <input type="text" name="aNumberField" onkeydown="javascript:maskInput()" />
        <asp:TextBox ID="Txtotherskillrating" CssClass="labelblack12text" runat="server"
            MaxLength="2" onkeydown="javascript:maskInput()"></asp:TextBox>
    </div>