Validation on Telephone No. in javascript
-
I am looking for a code in javascript which does not allow decimal values in the Telephone No. field(i.e textbox) Thanks & regards, Suresh Dayma
Everything Is Possible!
-
I am looking for a code in javascript which does not allow decimal values in the Telephone No. field(i.e textbox) Thanks & regards, Suresh Dayma
Everything Is Possible!
function KeyCheck(myfield,e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (((keycode>47) && (keycode<58) ) || (keycode==8)) { return true; } else return false; } You can use this function for keypress so that it will not allow u to put any characters but only numeric. If you have a HTML control then call this function by onkeypress="return KeyCheck(this,event);" Else on server side code write TxtPhone.Attributes.Add("onkeypress","return KeyCheck(this,event)"); Vicky "Walking on water and developing Software on a specification is easy, if both are frozen..."
-
function KeyCheck(myfield,e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (((keycode>47) && (keycode<58) ) || (keycode==8)) { return true; } else return false; } You can use this function for keypress so that it will not allow u to put any characters but only numeric. If you have a HTML control then call this function by onkeypress="return KeyCheck(this,event);" Else on server side code write TxtPhone.Attributes.Add("onkeypress","return KeyCheck(this,event)"); Vicky "Walking on water and developing Software on a specification is easy, if both are frozen..."
Thanks for your help.... Thanks & regards, Suresh Dayma
Everything Is Possible!