Here is an example on how you can customize MS CRM forms taking advantage of the On Change event.  Thanks Danny Knight for this Sample Codes.

How it works?  We would like the phone numbers to be auto-formatted with Parentheses and dashes.  Using this sample code, you can just type the number as per usual and the code will automatically mask it with the desired formatting.

In order to do this, you have to be in the Forms Customization section of MS CRM under Settings.  You just double click the Telephone Field and select on the Event Tab and you should be able to see On change event. Just paste this code and save the form.

// Attempt to auto-format basic phone numbers.  This method supports
// 7 and 10 digit numbers.  Example: (410) 555-1212
 
// Get the field that fired the event
var oField = event.srcElement;
 
// If we have the field and all is well
if (typeof(oField) != "undefined" && oField != null)
{
 // Remove any non-numeric characters
 var sTmp = oField.DataValue.replace(/[^0-9]/g, "");
 
 // If the number is a length we expect and support, format the number
 switch (sTmp.length)
 {
  case "4105551212".length:
   oField.DataValue = "(" + sTmp.substr(0, 3) + ") " + sTmp.substr(3, 3) + "-" + sTmp.substr(6, 4);
   break;
 
  case "5551212".length:
   oField.DataValue = sTmp.substr(0, 3) + "-" + sTmp.substr(3, 4);
   break;
 }
}