Description:
Definition of the function.
A function is a JavaScript procedure — a set of statements that performs a task or calculates a value. To use a function, you must define it somewhere in the scope from which you wish to call it.
Syntax:
function Name(Parameter1, Parameter2, ...)
{
Statement1
Statement2
...
}
Note:
Functions defined with function in the procedure are available only within the procedure.
Example1:
Function definition and calling:
Select and copy to clipboard
function Sum(a, b)
{
return a + b;
}
var c = Sum(1, 2);
Example4:
The same example as Example3 but the function is not named and declared in advance.
It is created on the point of entry (this can be used only with simple functions).
Select and copy to clipboard
var oForm = pMe.Form;
var oBtn1 = oForm.CreateItem("button", "btn1");
oBtn1.AddEvent("onAction", "btn1", function(ev) { if (ev.Action == "main") { Pm.Debug("Click UP"); } });
History:
Pm9.00.05: The statement is supported in the PROMOTIC system