JSObject Java ClassNameJSObject Java Class--- Java representation of a JavaScript objectAvailabilityIn the netscape.javascript package included with Navigator 3.0 Synopsis
public final class netscape.javascript.JSObject extends Object Methods
DescriptionThe 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. |
|