As part of the form design process, a form developer can use scripts to provide a richer user experience. You can add scripts to most form fields and objects. For example, you can create simple scripts to dynamically update values on an interactive form in response to user input.
Ensure that pop-up windows appear only as a result of user-initiated actions. Similarly, do not allow the current focus of the form to change or content to redisplay unless initiated by the user. The focus of the form refers to the user’s current view. For example, if the user is completing fields in the lower half of the form, do not allow the focus to change to the upper-left corner of the form unless the user chooses to navigate to this location.
Be aware that client-side scripts can interfere with screen readers and keyboards if the script changes the focus of the client application. For example, the change and mouseEnter events, when used with drop-down lists or list boxes, have the potential to cause inappropriate actions. Client-side scripting should be written to avoid problems with screen readers and keyboards.
See also 

Making scripts accessible