please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

JSObject Java Class

Name

JSObject Java Class--- Java representation of a JavaScript object

Availability

In the netscape.javascript package included with Navigator 3.0

Synopsis

public final class netscape.javascript.JSObject extends Object

Methods

call()

Invoke a method of the JavaScript object.

eval()

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

getMember()

Get the value of a property of the JavaScript object.

getSlot()

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

getWindow()

Get a "root" JSObject that represents the JavaScript Window object of the web browser.

removeMember()

Delete a property from the JavaScript object.

setMember()

Set the value of a property of the JavaScript object.

setSlot()

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

toString()

Invoke the JavaScript toString() method of the JavaScript object, and return 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, 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;
To compile an applet that uses JSObject, the compiler must be able to locate that class. Depending on the vendor of your compiler, this is usually done by setting your CLASSPATH environment variable. The actual class file for the JSObject class is found in the java_30 file that is part of the Navigator 3.0 distribution.

Full details on programming with the JSObject can be found in Chapter 19, LiveConnect: JavaScript and Java.

See Also

Chapter 19, LiveConnect: JavaScript and Java


Previous Home Next
JavaPackage Book Index JSObject.call()

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/java/script/definitive/refp_184.htm, 7KB, , updated: 2019/10/14 15:00, local time: 2024/11/23 18:42,
TOP NEW HELP FIND: 
18.217.10.200:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://techref.massmind.org/Techref/language/java/script/definitive/refp_184.htm"> [Chapter 21] Reference: JSObject</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to techref.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .