Home Articles Javascript Javascript : isnumeric funtion


Javascript : isnumeric funtion

User Rating: / 0
PoorBest 
Avatar

Creating a JavaScrit Functon to check the Numeric Values in a field... Unfortunalltyl which is not there inJavaScript By Default...
the function goes like This

[code]
<SCRIPT language="JavaScript" >

</SCRIPT>
[/code]

Now once a function is ready we can use it as follows to check a field and returns an error
message if the contents are not numeric:

[code]
if (document.formname.fieldname.value.length == 0)
{
alert("Please enter a value.");
}
else if (chkNumeric(document.formname.fieldname.value) == false)
{
alert("Please check - the string conatins non numeric value!");
}

[/code]





++

Thanks and Regards

Meetu Choudhary

Comments (0)
Only registered users can write comments!
Last Updated on Friday, 19 March 2010 09:03  

Member Login

AddThis Social Bookmark Button