Restrict Alphabet Input In TextBox

<html>
<head>

    <script language="javascript">
        function blockChar(e) {
            var keyVal = (window.event) ? event.keyCode : e.keyCode;
            if (window.event) keyVal = window.event.keyCode;
            if ((keyVal > 64 && keyVal < 93)) {
                return false;
            }
        }
    </script>

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

No comments:

Post a Comment