Formatting data being displayed

Giganews Newsgroups
Subject: Formatting data being displayed
Posted by:  tanhaa (sahir.fanat…@gmail.com)
Date: 22 Sep 2006

Hi all,

Just curious if Javascript can do this for me:

I have data stored in a particular format and when displaying that
data, I want it to be shown in specific format.

E.G. Phone numbers:

the numbers are stored in a string format:  3335551212

When the number is displayed, I want it to be displayed as:  (333)
555-1212

I know there are several ways where you can ensure that validation is
done when the data is being inserted so that the number can be stored
in (333) 555-1212 format, but i dont want the data to be stored like
that, I only want it to be displayed like that.

All my search on the web to see if this is possible has been really
fruitless.  Can anyone please help?

Amit Malhotra

Replies