Function to check Float:-
----------------------------
function ChkFloat(fld)
{
if(fld.value!='')
{
var id=fld.value;
var Reg=new RegExp("^[\-]{0,1}[0-9]{1,}(([\.\,]{0,1}[0-9]{1,})|([0-9]{0,}))$");
if(id.match(Reg)==null)
{
alert("Please Enter Numeric Values !");
fld.value='';
fld.focus();
return false;
}
if(id.indexOf("-")!=-1)
{
alert("Please Enter Positive Values !");
fld.value='';
fld.focus();
return false;
}
}
}
No comments:
Post a Comment