Name

JSObject — Java representation of a JavaScript object

Availability

Netscape 3, Internet Explorer 4

Synopsis

public final class netscape.javascript.JSObject extends Object

Methods

call( )

Invokes a method of the JavaScript object.

eval( )

Evaluates a string of JavaScript code in the context of the JavaScript object.

getMember( )

Gets the value of a property of the JavaScript object.

getSlot( )

Gets the value of an array element of the JavaScript object.

getWindow( )

Gets a “root” JSObject that represents the JavaScript Window object of the web browser.

removeMember( )

Deletes a property from the JavaScript object.

setMember( )

Sets the value of a property of the JavaScript object.

setSlot( )

Sets the value of an array element of the JavaScript object.

toString( )

Invokes the JavaScript toString( ) method of the JavaScript object and returns its result.

Description

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, invoking JavaScript methods, and 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.

Full details on programming with the JSObject can be found in Chapter 22.

See Also

Chapter 22

Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.