CRM 2011 provides a different feature to use java script as compared to CRM 4. In CRM 2011 you cannot write script directly in form event. Here they have provided a facility to create form library where you can write your own java script function. Only after creating a form library user will be able to call the function on form or field event.
To use the script on field or form event you will need to add a event handler, where you can specify the web resource library file and function name.
Follow the steps to create a form library file as shown below in the Screen shot.
• Click on Add button to add new form library
• You can add existing web resource or can add new web resource. Fill the details as below screen shot. To add the script click on Text Editor button and write the script.
• To use this function on Form load event you need to add event Handler and write the function as below screen shot.
• Select the library name in which you have write the script function and function name as below screen shot.
• Now save and publish the entity.
Note: if user is doing any modification on form library file then you need to go to web resource and select file and Publish it.