Home Cooker Classes 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

If the id attribute do not need, specify an empty string for the second argument.

Links for reference

None.

Copyright © Rice All rights reserved.