Home Notices Documents Classes Download Others Rice
Classes  >  jsexecutor  >  SetJS(string,string)
jsexecutor class : SetJS(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)

Arguments

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

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:

jse.SetJS(jsCode, id);

Notes

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

The charset attribute is utf-8. Therefore, the JavaScript code must encode with utf-8 encoding.

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.