JavaScript Applet Object

The JavaScript Applet object is used to refer to an applet. It is a property of the document object. It has no methods, properties, or events. Applets in the document can be found in the documents applets array. An applet may be referenced as shown below. To reference the first applet in the document.

document.applets[0]

To reference the applet by name (in cases where the applet tag specifies a name):

document.applets["Name"]

or:

document.appletName

Using Applets

An applet may be placed on an HTML page with the following code:

<applet name="ThisApplet" code="ThisApplet.class" WIDTH=150 height=50>
</applet>

If the applet had a method called printMessage(), it could be invoked with a line like:

document.ThisApplet.printMessage("This is a Test")