Home News DOC Class DL Others Rice
Class  >  jsexecutor  >  SetJS(string,string)
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:

window w;

2:

jsexecutor jse = w.CurrentJSExecutor;

3:

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 © Rice All rights reserved.