Hi everyone,
I am having problems with some javascript. I don't write javascript very often so this might be a really easy question to answer.
I have an asp page were people enter in information into a form. I want to format the phone numbers and the date fields. This is the script I have so far:
<script language="JavaScript">
function formatPhone(phoneValue)
{
var areaCode, three, four
var areaCode = phoneValue.substring(0, 3);
var three = phoneValue.substring(3, 6);
var four = phoneValue.substring(6, 10);
document.form1.phone.value = "(" + areaCode + ")" + " " + three + "-" + four
}
function formatDate(dateValue)
{
var m, d, y
var m = dateValue.substring(0, 2);
var d = dateValue.substring(2, 4);
var y = dateValue.substring(4, 8);
document.form1.startDate.value = m + "/" + d + "/" + y
}
</script>
Now I have about four places to enter in phone numbers. If I implement this as is all of the phone fields format the same. I need each phone field to format seperatly. Right now I'm using a javascript onblur comand on each field. Any help would be appriciated!