More than one decimal points are not allowed.

Rajni.Shekhar
Posted by Rajni.Shekhar under JavaScript category on | Points: 40 | Views : 1177
function checkdecimalPoints(ID)
{
var strString = document.getElementById(ID).value;
var currIndex=strString.indexOf('.');
var lastIndex=strString.lastIndexOf('.');
if(currIndex!=lastIndex)
{
alert('More than one decimal points are not allowed.');
document.getElementById(ID).value='';
document.getElementById(ID).focus();
return false;
}
return true;
}

Comments or Responses

Login to post response