Home Notices Documents Classes Download Others Rice
Classes  >  jsexecutor  >  SetJS(string,string,string)
jsexecutor class : SetJS(string,string,string) method

Description

It creates a script tag to current page, and directly puts JavaScript code to the script tag.

Syntax

jsexecutorInstance.SetJS(string jsCode, string id, string charSet)

Arguments

ClassNameDescription
stringjsCodeJavaScript code that is put to the script tag.
stringidA value of id attribute.
stringcharSetAn appropriate encoding name.

Return value

None.

Sample code

1:

jsexecutor jse = new jsexecutor();

2:

string jsCode = "function Hello(){alert('Hello World!');}";

3:

string id = "js"; // An identifier for the script tag to be created.

4:

string charSet = "utf-8";

5:

jse.SetJS(jsCode, id, charSet);

Notes

This method creates new script tag with id attribute, and directly puts JavaScript code to the script tag.

You can specify the encoding of JavaScript code.

Note for Ver 1.0.0.1

Escape sequences may not work properly in strings of the JavaScript code given as arguments.

The order of the arguments has been changed.

Note for Ver 1.0.0.2

Above escape sequences problem is fixed.

Links for reference

None.

Copyright © Rice All rights reserved.