On a webpage lets say we have a function addOnClick(num).  We want to execute that function directly in the Rapise script. In the developer console of the web browser we can type in addOnClick(1063) and it will perform the action that we want.  The question is how to execute this function directly in the Rapise script?
The Html is:
<span id="Add" class="Link" onclick="addOnClick(1063)">Add</span>
 
Unlike simply calling a DOM command such as alert('xxx'); calling this function requires that we actually have this function part of the browser DOM. This is because the Rapise ExecJS function is able to 'see' only DOM model and default methods of global objects (window, document, navigator).

As far as 'alert' is method of 'window' it works. But 'addOnClick' is a regular function defined in the page and it does not work because it is in different namespace.

This explains the difference between two examples below:

<script>
function MyFunctionForExecJS1()
{
    alert("MyFunctionForExecJS1");
};

window.MyFunctionForExecJS2 = function()
{
    alert("MyFunctionForExecJS2");
};
</script>


This will not work, it is a private function:

//Open up the IE browser window
Navigator.Find('/html', '
http://www.inflectra.com',null, {executable:"iexplore.exe"});
Navigator.ExecJS("MyFunctionForExecJS1();");

But this will work:

//Open up the IE browser window
Navigator.Find('/html', '
http://www.inflectra.com',null, {executable:"iexplore.exe"});
Navigator.ExecJS("window.MyFunctionForExecJS2();");