Previous Topic: Javascript ValidationNext Topic: Custom iConsole Functions


Javascript Global Statements

The use of Javascript global statements is not supported, except for the definition of global variables. Because of the asynchronous loading process used in the iConsole for some elements, global statements might be executed before the page loading is complete in the browser and will not be executed on returning to the page. This could lead to errors or unwanted behavior.

To illustrate this, the references to "RemoveAnyFromAuditList" are calls to a user-defined function (defined later in the report Javascript but not shown here):

<script language="javascript">
<!-- 
RemoveAnyFromAuditList(1);
RemoveAnyFromAuditList(2);

function LocalReset()
{
	// LocalReset is called automatically when the page is loaded (or reloaded)
	SetInterventionchk();
       }
-->
</script>

If these functions are required to be executed on page load and reload, they must be moved to the standard function LocalReset as follows:

<script language="javascript">
<!-- 
function LocalReset()
{
	// LocalReset is called automatically when the page is loaded (or reloaded)
             RemoveAnyFromAuditList(1);
             RemoveAnyFromAuditList(2);
             SetInterventionchk();
       }
-->
</script>