April 27, 2011

Accept Number Only in JavaScript

var mob= document.getElementById("CustMob").value;
var matchArr1 = mob.match( /^[0-9]+$/);
if (matchArr1 == null)
{
alert('Fill Customer Mobile No and It Should be numeric only ');
document.form1.CustMob.focus();
return(false);
}

No comments:

Post a Comment