36.6 ADD_INLINE_CODE Procedure
This procedure adds a code snippet that is included inline into the HTML output. For example, you can use this procedure to add new functions or global variable declarations.
Note:
If you want to execute code you should use ADD_ONLOAD_CODE Procedure.
Syntax
APEX_JAVASCRIPT.ADD_INLINE_CODE (
p_code IN VARCHAR2,
p_key IN VARCHAR2 DEFAULT NULL);
Parameters
Table 36-6 ADD_INLINE_CODE Parameters
Parameter | Description |
---|---|
|
JavaScript code snippet. For example: |
|
Identifier for the code snippet. If specified and a code snippet with the same name has already been added, the new code snippet is ignored. If |
Example
The following example includes the JavaScript function initMySuperWidget
in the HTML output. If the plug-in is used multiple times on the page and the add_inline_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_inline_code (
p_code => 'function initMySuperWidget(){'||chr(10)||
' // do something'||chr(10)||
'};',
p_key => 'my_super_widget_function' );
Parent topic: APEX_JAVASCRIPT