Table of Contents | Previous
| Next
| Index
The public final class netscape.javascript.JSObject extends Object.
java.lang.Object | +----netscape.javascript.JSObject
JavaScript objects are wrapped in an instance of the class netscape.javascript.JSObject and passed to Java. JSObject allows Java to manipulate JavaScript objects.
When a JavaScript object is sent to Java, the runtime engine creates a Java wrapper of type JSObject; when a JSObject is sent from Java to JavaScript, the runtime engine unwraps it to its original JavaScript object type. The JSObject class provides a way to invoke JavaScript methods and examine JavaScript properties.
Any JavaScript data brought into Java is converted to Java data types. When the JSObject is passed back to JavaScript, the object is unwrapped and can be used by JavaScript code. See the Client-Side JavaScript Guide for more information about data type conversions.
The netscape.javascript.JSObject class has the following methods:
The netscape.javascript.JSObject class has the following static methods:
The following sections show the declaration and usage of these methods.
Method. Calls a JavaScript method. Equivalent to "this.methodName(args[0], args[1], ...)" in JavaScript.
public Object call(String methodName, Object args[])
Method. Determines if two JSObject objects refer to the same instance.
Overrides: equals in class java.lang.Object
public boolean equals(Object obj)
Method. Evaluates a JavaScript expression. The expression is a string of JavaScript source code which will be evaluated in the context given by "this".
public Object eval(String s)
Method. Retrieves the value of a property of a JavaScript object. Equivalent to "this.name" in JavaScript.
public Object getMember(String name)
Method. Retrieves the value of an array element of a JavaScript object. Equivalent to "this[index]" in JavaScript.
public Object getSlot(int index)
Static method. Returns a JSObject for the window containing the given applet. This method is useful in client-side JavaScript only.
public static JSObject getWindow(Applet applet)
Method. Removes a property of a JavaScript object.
public void removeMember(String name)
Method. Sets the value of a property of a JavaScript object. Equivalent to "this.name = value" in JavaScript.
public void setMember(String name, Object value)
Method. Sets the value of an array element of a JavaScript object. Equivalent to "this[index] = value" in JavaScript.
public void setSlot(int index, Object value)
Method. Converts a JSObject to a String.
Overrides: toString in class java.lang.Object
public String toString()
Table of Contents | Previous
| Next
| Index
Last Updated: 05/28/99 12:01:19
Copyright (c) 1999
Netscape Communications Corporation
|