I am writing code for validating the money value as
function monyValid()
{
var valw=document.getElementById("<%=txtID4.ClientID%>").value;
var regex = /(?:^\d{1,3}(?:\.?\d{2})*(?:,\d{2})?$)|(?:^\d{1,3}(?:,?\d{3})*(?:\.\d{2})?$)/
if (!isNaN(valw) && isFinite(valw))
{
document.getElementById("<%=txtID4.ClientID%>").value=parseFloat(valw).toFixed(2);
}
if (regex.test(valw))
{
alert("valid");
}
else
{
alert("Number is invalid");
}
}
now I want to apply the same validation to multiple textboxes. How can I use the same function for different textboxes. I want something like
function monyValid(txtVal)
{
var valw=document.getElementById(txtVal).value;
}
How can I implement this function.