Skip to main content

Restrict Numberic Input In TextBox

<html>
<head>

    <script language="javascript">
        function blockNum(e) {
            var keyVal = (window.event) ? event.keyCode : e.keyCode;
            if (window.event) keyVal = window.event.keyCode;
            if ((keyVal > 47 && keyVal < 58) || (keyVal > 95 && keyVal < 107)) {
                return false;
            }
        }
    </script>

</head>
<body onload="javascript:document.getElementById('txt').focus();">
    <input type="text" id='txt' onkeydown="return blockNum(this);" />
</body>
</html>

Comments

Popular posts from this blog