In the netscape.javascript package included with Navigator 3.0
public final class netscape.javascript.JSObject extends Object
Invoke a method of the JavaScript object.
Evaluate a string of JavaScript code in the context of the JavaScript object.
Get the value of a property of the JavaScript object.
Get the value of an array element of the JavaScript object.
Get a "root" JSObject that represents the JavaScript Window object of the web browser.
Delete a property from the JavaScript object.
Set the value of a property of the JavaScript object.
Set the value of an array element of the JavaScript object.
Invoke the JavaScript toString() method of the JavaScript object, and return its result.
The JSObject is a Java class, not a JavaScript object; it cannot be used in your JavaScript programs, Instead, the JSObject is used by Java applets that wish to communicate with JavaScript by reading and writing JavaScript properties and array elements, by invoking JavaScript methods, and by evaluating and executing arbitrary strings of JavaScript code. Obviously, since JSObject is a Java class, you must understand Java programming in order to use it.
A Java applet that wishes to use the JSObject class must obtain an initial JSObject instance that represents the web browser window that the applet is running in. The JSObject class does not define a constructor method, so the only way to obtain this initial instance is by invoking the static getWindow() method, and passing it the java.applet.Applet instance that represents the applet. This static method returns a "root" JSObject instance, and you can use the getMember() and getSlot() methods to obtain any other JSObjects that the applet requires.
Note that if an applet uses the JSObject class, it must have the MAYSCRIPT attribute set in its <APPLET> tag, or it will not be allowed to manipulate JavaScript from Java. Also, an applet that uses the JSObject class should import the class with a line like the following:
import netscape.javascript.JSObject;
Full details on programming with the JSObject can be found in Chapter 19, LiveConnect: JavaScript and Java.
This HTML Help has been published using the chm2web software. |