Fragments can contain reusable JavaScript functions or values that are stored separately from any particular script object. You use these fragments to create custom functions and properties that you want to use in many locations on a form or that you want to use in many forms.
For example, the countryScript sample fragment controls the interaction between the Country and State/Province drop-down lists in the sample forms. The options that appear in the State/Province drop-down list depend on the country selected in the Country drop-down list.

About using fragments that contain script