AddOnLoadScript function
Syntax
AddOnLoadScript(onload_script)
Description
Use the AddOnLoadScript function to add the JavaScript code to be executed in the onload event of the HTML document.
Important:
Use this function within fluid applications only.
If multiple invocations of the AddOnLoadScript function that are batched into a single server trip include identical JavaScript invocations, the first duplicate JavaScript invocation will be executed, and the subsequent duplicates are ignored.
In the following example, the last
AddOnLoadScript("execFunc('open');"); is ignored because it is identical to the first
invocation.
AddOnLoadScript("execFunc('open');");
…
AddOnLoadScript("execFunc('close');");
…
/* This will never execute because it duplicates the first call. */
AddOnLoadScript("execFunc('open');");
To overcome this situation, add a unique comment to subsequent identical lines of code to make them unique.
For example:
AddOnLoadScript("execFunc('open'); /*1*/");
Parameters
| Parameter | Description |
|---|---|
|
onload_script |
Specifies the JavaScript code to be executed in the onload event of the HTML document as a string value. |
Returns
None.
Example
AddOnLoadScript("document.querySelector('.ps_header').style.display = 'none';");