jsexecutor class : SetJS(string,string) method
Description
Creates a script tag and insert the JavaScript code.
Syntax
instance.SetJS(string jscode, string id)
Arguments
Class | Name | Description |
string | jscode | JavaScript code. |
string | id | id 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.