ADD_ONLOAD_CODE Procedure
This procedure adds a JavaScript code snippet to the HTML output which the onload event executes. If an entry with the same key exists, it is ignored. If p_key is NULL the snippet is always added.
Syntax
APEX_JAVASCRIPT.ADD_ONLOAD_CODE (
p_code IN VARCHAR2,
p_key IN VARCHAR2 DEFAULT NULL )
Parameters
| Parameter | Description |
|---|---|
p_code |
JavaScript code snippet to execute during the onload event. |
p_key |
Any name to identify the specified code snippet. If specified, the code snippet is added if there has been no other call with the same p_key. If p_key is NULL the code snippet is always added. |
Example
Adds the JavaScript call initMySuperWidget( to the onload buffer. If the plug-in is used multiple times on the page and the add_onload_code is called multiple times, it is added once to the HTML output because all calls have the same value for p_key.
apex_javascript.add_onload_code (
p_code => 'initMySuperWidget();',
p_key => 'my_super_widget' );