Adding applets with applet

The applet element is a container for any number of parameter (param) elements. The following is an example of how an applet element for a game might look:

<applet codebase=class code="Wacky.class" width="300" height="400">
  <param name="Delay" value="250" />
  <param name="Time" value="120" />
  <param name="PlaySounds" value="YES" />
</applet>

The applet element contains a number of standard attributes:

code

Tells the browser which applet will be used. Applets end with the suffix .class or .jar. This attribute is required.

codebase

This tells the browser in which directory to find the applets. If the applets are in the same directory as the page, the codebase attribute is not necessary.

width, height

These specify the pixel dimensions of the “window” the applet will occupy. These attributes are required for the Java applet to function properly.

The applet element may also use many of the same attributes used for images, such as alt for providing alternative text if the applet cannot be displayed, and presentational attributes such as align (for positioning the applet in the flow of text), and hspace/vspace (used in conjunction with align).

Special parameters for the applet are provided by any number of parameter elements (sometimes there are none). The param element always contains the name of the parameter (name) and its value (value). Parameters provide special settings and controls that are specific to the particular applet, so you need to follow the parameter ...

Get Web Design in a Nutshell, 3rd 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.