JsRun Method (CLIENT)


PLB Web Only, 9.9B

 

The JsRun method executes JavaScript at the client browser within the 'plbwebbasic' JavaScript runtime instance. The method uses the following format:

 

[label]

{object}.JsRun

[GIVING {return}] USING [*JS=](javascript}][:

 

 

[*Options=]{flags{]]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A CLIENT object.

return

Optional. A Character String Variable that returns the result from a JavaScript function that is executed.

javascript

Required. A Character String Variable or string literal contains the JavaScript code to be executed.

flags
Optional. A Numeric Variable or decimal number that specifies a bit mask value that controls the behaviors of this method.

Flags Affected: OVER, ZERO

Note the following:

  1. The EOS flag is set TRUE if the JavaScript return variable is to small to receive the JavaScript function result without without being truncated.

  2. The ZERO flag is always cleared.

  3. The OVER flag is always cleared.

  4. The optional {options} bit mask values can change the execution behavior of the JsRun method as follows:

  5.  

    Value

    Meaning

    0x0

    The default value which allows JavaScript code to be executed.

     

  6.  The JsRun method dynamically loads, executes, and returns a result from a JavaScript function executed by the client browser. Also, the JsRun method can execute any previously loaded JavaScript functions that exist in the 'plbwebbasic' runtime instance\scope at the client browser.

  7. Sample JavaScript code to invoke an 'alert' at the client browser followed by the returned string of another JavaScript function named 'PlbApiTest1'.

  8.  

    RESDATA

    DIM

    50

    C

    CLIENT

     

    nVar

    FORM

    2

     

    The JavaScript function 'PlbApiTest1' exists as a sample function found in the c:\sunbelt\plbwebsrv.9xx\http_root\plbwebctls.js' file.

     

    JsCode

    INIT

    "alert( 'Hi from the JavaScript!' );":

     

     

    "PlbApiTest1('sample data!');"

     

     

     

     

    C.JsRun

    GIVING RESDATA USING JsCode

     

    ALERT

    NOTE, RESDATA, nVar, "JsRun Method Result!"

     

    Stop

     

     

     

    See Also: CLIENT, Client Methods, Method Syntax



    PL/B Language Reference JqGet Method (CLIENT) JqSet Method (CLIENT)