Thursday, October 9, 2008

validate the onlynumber for text box like money (13245.55)dot allowed using java scripts

function isDecimalKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode

if(charCode==46)
{

return true;
}
else
{
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
}
return true;

}

//in the copd addthe follown=ing to the text box event

onkeypress="return isDecimalKey(event)"

No comments: