Dijit is a web UI toolkit built on top of the Dojo framework. One of its widgets is called NumberTextBox. This widget allows you to show and edit formatted numbers easily.
For example, I can create an instance of CurrencyTextBox (a subclass of NumberTextBox) and call set("value", 2589632). This will display the value as follows (assuming that my locale is set to en_US):
If I click in the box to edit the value, it changes back to just numbers and looks like this: