14. Applets and HTML
<APPLET> tag specifies applet information in a HTML page
It must be enclosed between <BODY> and </BODY>
</APPLET> tag is mandatory to close the <APPLET> tag
CODE, WIDTH and HEIGHT are mandatory attributes within </applet> <APPLET> tag. Their order is not significant. Instead of the class file, applet can specified via a serialized file using OBJECT attribute. If we specify OBJECT attribute CODE attribute is not specified and vice versa.
In HTML 4.0, OBJECT tag can be specified instead of APPLET tag. With OBJECT tag, we specify the applet with CLASSID attribute.
The following are other optional tags
Tag Name | Purpose |
---|---|
CODEBASE | Directory for the applet's class |
ALT | Alternate text for browsers with no support for applets but can understand <APPLET> tag |
HSPACE | Left/Right boundaries b/w other HTML elements on a page |
VSPACE | Top/Bottom boundaries b/w other HTML elements on a page |
ALIGN | Alignment with respect to other HTML elements |
NAME | Name of the applet for inter-applet communication |
ARCHIVE | Name of the JAR file (Lot of files can be downloaded in a single download to reduce the time needed) Even multiple jar files can be specified, separated by commas. |
OBJECT | Specified if CODE attribute is not present and vice versa. Applet is read in from the specified serialized file. |