PDA

View Full Version : Phone Number Format


carlg
11-21-2004, 08:47 PM
Not sure if this is an html or Jscript question.

I want to be able to format a phone number in a text field that the user will enter.

For example, the phone number must be entered by the user in the following format (233)555-1212

I want to make the input text field so that the parantheses and the dash are already present when the page is loaded and all the user has to do is enter the number.

Anybody know how I can do this ???

Thanks for the help

Carl

eRad
11-22-2004, 11:19 AM
have 3 separate textboxes, and surround them with the brackets/dashes? then just append them together to get the whole number

something like
(<input id="first" style="width:25px;" maxlength="3">)
<input id="middle" style="width:25px;" maxlength="3">-
<input id="last" style="width:35px;" maxlength="4">

can change the width depending on your page's font etc..

123456789
11-22-2004, 03:42 PM
or you could do this:

<input type="text" value="()">