1. Write HTML or JS using any editor .
2. Add it as a web resource to MSCRM
Select JS Page as the type and either write in editor or upload the JS file.
3. Save and publish the web resource.
4. Add web Resource from the Customization tab. Account Form >> Click on Form Properties from the Top Menu
5. Add JS web resource in Events
6. Add function in event handlers
SOURCE : mscrm.com