This section gives the complete syntax for the tag.
The information in this section does not apply if you are writing applets that use the Java™ Plug-in, such as Swing applets. Simply put, Netscape Navigator browsers require the tag and Microsoft Explorer browsers use the tag in place of the tag. You can read more about deploying applets using the Java Plug-in online at http://java.sun.com/products/plugin/.
When you build tags, keep in mind that such words as APPLET and CODEBASE can be entered either as shown or in any mixture of uppercase and lowercase letters. In the following, entries in boldface indicate something you should type in exactly as shown, except that letters don't need to be uppercase. Entries in italic indicate that you must substitute a value for the word in italics. Brackets ([ and ]) indicate that the contents within the brackets are optional. Parentheses (( and )) indicate that you must choose exactly one of the separated contents.
< APPLET [CODEBASE = codebaseURL] (CODE = appletFile | OBJECT = serializedApplet) [ARCHIVE = archivesList] [ALT = alternateText] [NAME = appletInstanceName] WIDTH = pixels HEIGHT = pixels [ALIGN = alignment] [VSPACE = pixels] [HSPACE = pixels] > [< PARAM NAME = appletParameter1 VALUE = value >] [< PARAM NAME = appletParameter2 VALUE = value >] . . . [alternateHTML]
CODEBASE = codebaseURL
This optional attribute specifies the base URL of the appletthe directory or the folder that contains the applet's code. If this attribute is not specified, the document's URL is used.
CODE = appletFile
This attribute gives the name of the file that contains the applet's compiled Applet subclass. This file is relative to the base URL of the applet and cannot be absolute. Either CODE or OBJECT must be present.
OBJECT = serializedApplet
This attribute gives the name of the file that contains a serialized representation of an applet. The applet will be deserialized. The init method will not be invoked, but its start method will be. Attributes that are valid when the original object was serialized are not restored. Any attributes passed to this Applet instance will be available to the applet. We advise you to exercise very strong restraint in using this feature. An applet should be stopped before it is serialized. One of CODE or OBJECT must be present.
ARCHIVE = archivesList
This optional attribute describes one or more archives containing classes and other resources that will be preloaded. The classes are loaded by using an instance of an AppletClassLoader with the given CODEBASE.
ALT = alternateText
This optional attribute specifies any text that should be displayed if the browser understands the tag but can't run applets.
NAME = appletInstanceName
This optional attribute specifies a name for the Applet instance. Naming applets makes it possible for applets on the same page to find and to communicate with each other.
WIDTH = pixels HEIGHT = pixels
These required attributes give the initial width and height in pixels of the applet display area, not counting any windows or dialogs that the applet brings up.
ALIGN = alignment
This required attribute specifies the alignment of the applet. Its possible values are the same (and have the same effects) as those for the tag and are the following: LEFT, RIGHT, TOP, TEXTTOP, MIDDLE, ABSMIDDLE, BASELINE, BOTTOM, and ABSBOTTOM.
VSPACE = pixels HSPACE = pixels
These optional attributes specify the number of pixels above and below the applet (VSPACE) and on each side of the applet (HSPACE). They're treated in the same way as the tag's VSPACE and HSPACE attributes.
< PARAM NAME = appletParameter1 VALUE = value >
Use of a tag is the only way to specify an applet-specific parameter. Applets read user-specified values for parameters by using the getParameter method.
If the HTML page containing this tag is viewed by a browser that doesn't understand the tag, the browser will ignore theand tags. It instead will interpret any other HTML code between the and tags. Java-compatible browsers ignore this extra HTML code.
In the online version of this tutorial, we use alternate HTML to show a snapshot of the applet running, with text explaining what the applet does. Other possibilities for this area are a link to a page that is more useful for the applet-disabled browser or text that taunts the user for not having a compatible browser.
POSIX Conventions for Command Line Arguments