<!-- Script by hscripts.com -->
/* Created on : Dec 1,2007
Javascript for validating a rounded integer value.
This script validates the given input and returns true or false.
You have to just call the function with the input as argument.
Eg:var d = isInteger(3); returns true;
var e = isInteger(4.4); returns false;*/
<script type="text/javascript">
function isInteger(s)
{
var i;
s = s.toString();
for (i = 0; i < s.length; i++)
{
var c = s.charAt(i);
if (isNaN(c))
{
alert("Given value is not a number");
return false;
}
}
return true;
}
</script>
<!-- Script by hscripts.com -->
HTML code
<!-- Script by hscripts.com -->
<form name=test>
<input type=text name=en onKeyup="isInteger(this.value)">
<input type=button name=cc value="Check" >
</form>
<!-- Script by hscripts.com -->
0 Response to "validationscript"
Post a Comment