<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> <title></title> <script language="javascript"> function IsNumeric(sText,obj) { var ValidChars = "0123456789."; var IsNumber=true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } if(IsNumber==false){ alert("Only numberic value"); obj.value=sText.substr(0,sText.length-1); } } </script> </head> <body> <form name="form1" method="post" action=""> <input name="mynumber" type="text" id="mynumber" onKeyUp="IsNumeric(this.value,this)"> </form> </body> </html>