I have the following function which validates numbers from an asp.net control (basically masking).
and call the function by simply putting "IsNumeric" without specifically passing the parameters.
I would like to replace "ctl00_cphMainContent_txtPID" with a variable that I can pass into the function. Can someone tell me how to do this? If I try to add another variable then the function stops working.
Thanks,
J
Code:
<script language="javascript">
function IsNumber(source,arguments)
{
var ValidChars = "0123456789";
var Char;
var sText=document.getElementById("ctl00_cphMainContent_txtPID").value;
for (i = 0; i < sText.length; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
arguments.IsValid = false;
return;
}
}
return;
}
</script>
and call the function by simply putting "IsNumeric" without specifically passing the parameters.
I would like to replace "ctl00_cphMainContent_txtPID" with a variable that I can pass into the function. Can someone tell me how to do this? If I try to add another variable then the function stops working.
Thanks,
J