Name

<APPLET> — NN 2 IE 3 HTML 3.2

Synopsis

<APPLET>...</APPLET>

End Tag: Required

You can embed an executable chunk of Java code in an HTML document in the form of an applet. An applet occupies a rectangular area of the page, even if it is only one-pixel square. An applet may require that some initial values be set from the HTML document. One or more PARAM elements can be used to pass parameters to the applet before the applet starts running (provided the applet is written to accept these parameters). PARAM elements go between the start and end tags of an APPLET element.

Applets are compiled by their authors into class files (filename suffix .class). An applet class file must be in the same directory as, or a subdirectory of, the HTML document that loads the applet. Key attributes of the APPLET element direct the browser to load a particular class file from the necessary subdirectory.

All user interface design for the applet is programmed into the applet in the Java language. One of the roles of attributes in the APPLET element is to define the size and other geographical properties of the applet for its rendering on the page. Recent browsers allow JavaScript scripts to communicate with the applet, as well as allowing applets to access document elements.

Note that HTML 4.0 deprecates the APPLET element in favor of the more generic OBJECT element. Browser support for the APPLET element will continue for some time to come, however.

Example

<APPLET CODE="simpleClock.class" NAME="myClock" ...

Get Dynamic HTML: The Definitive Reference 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.