jsexecutor class : SetJS(string,string) method

Description

Creates a script tag and insert the JavaScript code.

Syntax

instance.SetJS(string jscode, string id)

Arguments

ClassNameDescription
stringjscodeJavaScript code.
stringidid attribute.

Return value

None.

Sample code

1:

jsexecutor jse; // For Main-browser

2:

jse.SetJS("function hello(){alert('hello world!');}", "smple"); // It creates a script tag has JS code and id.

The following script tag is added to the body tag.

1:

<script id="sample">

2:

function hello(){alert('hello world!');}

3:

</script>

Notes

If you specify an empty string as the first argument, an exception, RtypeException, will occur.

Links for reference

None.

Copyright © Cooker All rights reserved.