See also: fvFormatPhone |
Function used to format a phone number according to a specific format.
JSV_fsFormatPhone(expP [, expM])
n/a
The fsFormatPhone function returns the phone number formatted in accordance with the designated format.
The fsFormatPhone function uses the following arguments.
Argument | Description |
expP | The phone number. |
expM | Optional. Mask used to format the phone number where 'X' represents a single digit. Default format is (XXX) XXX-XXXX. |
n/a
JSV_isWhitespace, JSV_stripCharacters, JSV_occurs
The following lines of code
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
function fmtPhone() {
document.TestForm.PhoneNo.value =
JSV_fsFormatPhone(document.TestForm.PhoneNo.value, document.TestForm.Mask.value);
}
</SCRIPT>
<FORM NAME="TestForm">
Phone: <INPUT TYPE="Text" NAME="PhoneNo" VALUE="6072341234" SIZE="16" MAXLENGTH="32">
Mask: <INPUT TYPE="Text" NAME="Mask" VALUE="(XXX) XXX-XXXX" SIZE="16" MAXLENGTH="16">
<INPUT TYPE="Button" NAME="FmtFone" VALUE="Format Phone" onClick="fmtPhone();">
<INPUT TYPE="Reset">
</FORM>
produce
Copyright © 1998-2000 Roaring Fork Software. All rights reserved.