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

Arguments

ClassNameDescription
stringjsCodeJavaScript code that is put to the script tag.

Return value

None.

Sample code

1:

jsexecutor jse = new jsexecutor();

2:

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

3:

jse.SetJS(jsCode);

Notes

This method creates new script tag without 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.

Note for Ver 1.0.0.2

Above escape sequences problem is fixed.

Links for reference

None.

Copyright © Rice All rights reserved.