Promotic
WikipediaLinkedInYoutubeTwitterFacebook

function - statement of language JavaScript

Description:
Function declaration.

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(par1, par2, ...)

{

  statement1

  statement2

  ...

}

Note:
Functions declared 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);
Example2:
Adding a function into the onAction event of the PmfButton object.
Select and copy to clipboard

var oForm = pMe.Form;
var oButton = oForm.CreateItem("button", "butt1");
oButton.AddEvent("onAction", function(ev) { if (ev.Action == "main") Pm.Debug("Click UP"); });

History:
Pm9.00.05: The command is now supported in the in the PROMOTIC system
PROMOTIC 9.0.7 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice