To Validate Numbers Using JavaScript

Chikul
Posted by Chikul under JavaScript category on | Views : 2197
function Validatenumber(obj)
{
if (obj.length !=0)
{
var text = /^[-0-9]+$/;
if ((document.getElementById(obj.id).value!="")&&(!text.test(document.getElementById(obj.id).value)))
{
alert("Please enter numeric values only");
obj.focus();
obj.select();
}
}
}

Comments or Responses

Login to post response