JavaScript Body
The JavaScript body is mandatory. Swift MEAPâ„¢ registers event handlers by detecting their presence in the body of the JavaScript code. All event handlers must be located within the JavaScript body.
The JavaScript body uses the following script tag structure:
<script type="text/javascript"> /** Your event handlers go inside the script tag **/ </script>
There must be exactly one JavaScript body and it must have the following type:
script type="text/javascript"
The code within the JavaScript body must conform to the normal JavaScript rules for an HTML page with no visible body content. You can use "window.location" in limited circumstances (for more information, see "showAlert"), but the HTML page structure should not be used.
To facilitate registration, all event handlers must be defined at the start of the JavaScript body. Thereafter, you can add any valid JavaScript code as required. It is important to adhere to the JavaScript rules for variable and function declaration. You can use the following types of event handlers in JavaScript code:
- fieldsOnEvent and onEvent handlers. For more information, see "Event Handlers: fieldsOnEvent and onEvent".
- eventJSON handlers. For more information, see "Event Handlers: eventJSON".
- Standard handlers. For more information, see "Event Handlers: Standard Handlers".