function IsIntegerFloatDot(sText) { var ValidChars = "0123456789."; var IsNumber=true; var Char; var Count=0; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (Char == '.' ) { Count++; } if (ValidChars.indexOf(Char) == -1 || Count > 1) { IsNumber = false; } } return IsNumber; and function called as if(trimSpaces(document.getElementById("txtAmount").value) != "") { var txtTotalEmployees = document.getElementById("txtAmount") if (IsIntegerFloatDot(txtTotalEmployees.value)==false) { alert("Amount should be numeric values."); txtTotalEmployees.focus(); return false; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)