JavaScript to format an input textbox as a phonenumber


As you "keyup", each keystroke is sent to the "format" function. The contents of the text box have all non-numeric characters removed. The function then updates the contents of the input box with the proper formatting!