Table of Contents | Previous | Next | Index

# Applet

Includes a Java applet in a web page.

Client-side object |
Implemented in | JavaScript 1.1

#### Created by

The HTML `APPLET` tag. The JavaScript runtime engine creates an `Applet` object corresponding to each applet in your document. It puts these objects in an array in the `document.applets` property. You access an `Applet` object by indexing this array. To define an applet, use standard HTML syntax. If you specify the `NAME` attribute, you can use the value of that attribute to index into the `applets` array. To refer to an applet in JavaScript, you must supply the `MAYSCRIPT` attribute in its definition.

#### Description

The author of an HTML page must permit an applet to access JavaScript by specifying the `MAYSCRIPT` attribute of the `APPLET` tag. This prevents an applet from accessing JavaScript on a page without the knowledge of the page author. For example, to allow the `musicPicker.class` applet access to JavaScript on your page, specify the following:

    <APPLET CODE="musicPicker.class" WIDTH=200 HEIGHT=35
       NAME="musicApp" MAYSCRIPT>

Accessing JavaScript when the `MAYSCRIPT` attribute is not specified results in an exception. For more information on using applets, see the LiveConnect information in the Client-Side JavaScript Guide.

#### Property Summary

The `Applet` object inherits all public properties of the Java applet.

#### Method Summary

The `Applet` object inherits all public methods of the Java applet.

#### Examples

The following code launches an applet called `musicApp`:

    <APPLET CODE="musicSelect.class" WIDTH=200 HEIGHT=35
       NAME="musicApp" MAYSCRIPT>
    </APPLET>

For more examples, see the LiveConnect information in the Client-Side JavaScript Guide.

#### See also

`MimeType`, `Plugin`

Table of Contents | Previous | Next | Index

Last Updated: 05/28/99 11:58:59

Copyright (c) 1999 Netscape Communications Corporation