srinidelite -4 Newbie Poster
 <script type="text/javascript">
        function validate(evt) {
            var theEvent = evt || window.event;
            var key = theEvent.keyCode || theEvent.which;
            key = String.fromCharCode(key);
            var regex = /[0-9]|\./;
            if (!regex.test(key)) {
                theEvent.returnValue = false;
                alert("Only Numeric is Allowed");
                if (theEvent.preventDefault) theEvent.preventDefault();
            }
        }

    </script>

Hello,

I'm using the above script for my forms to validate for the TEXTBOX , to alllow user to edit Numeric only

but the problem is when user switch from one textbox box to another he/she presses TAB key it alerts "only Numeric allowed"

and same for backspace key...

I want to Modify the above code to allow these TWO (TAB,BACKSPACE) Keys to Function ... Can Any one Help me ??


Thanks in Advance,
Srini.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.