object tag
param tag
img tag
TAG: applet
deprecated 4.0
<applet> ... </applet>
Available in versions: 3.2
Browser compatibility: Explorer 4, 5 Netscape 6
The
<applet>
tag is officially deprecated effective with HTML 4.0. Instead, you are now to use the
object
tag. However, this tag remains in wide use on the Internet and is recognized by all major browsers.
The
applet
tag is used to download and execute a Java applet. The applet is treated like an image and is rendered into the flow of the text without a line break. You can define the size of the region (the applet window) in which the applet will appear. By using the attributes for
applet
, style sheets code, and other HTML tags, you can create a presentation and appearance for the applet in the text flow to suit your needs.
Java applets can be very slow to load and may not display in many browsers.
Many Java applets require that document-specific parameters be provided to control the execution. You can use the
param
tag, inserted between the opening and closing
applet
tags, to define these parameters.
The closing tag is mandatory.
Core Attributes
class
id
style
title
Attributes
align
The
align
attribute is used to position the applet window with respect to any surrounding text, images, or other applets.
alt
The
alt
attribute provides a text message that will be displayed (in place of the applet) on browsers that cannot display an applet.
archive
The
archive
attribute is a comma-separated list of URLs of Java classes that must be pre-loaded into the local user cache before the applet can be displayed.
code
The
code
attribute is mandatory and specifies the relative URL of the Java class (a .class type file) that must be executed to display the applet. Specifically, the URL is relative to the applet base URL (otherwise the applet will not load).
codebase
The
codebase
attribute is used to specify the URL of the directory where the Java class is stored. If the directory is different from where the HTML code is stored, you must use this attribute.
height
The
height
attribute is used to set the vertical extent of the applet in pixels.
hspace
The
hspace
attribute is used to add additional blank space in pixels to each side of the applet.
mayscript
The
mayscript
attribute is only recognized by Netscape. It permits the applet to access JavaScript code.
name
The
name
attribute is used to assign a unique string of characters as the name of the applet.
object
The
object
attribute is not supported by most browsers. It is the name of a resource where a serialized version of the applet is stored. Do not confuse this attribute with the
object
tag.
vspace
The
vspace
attribute is used to add additional blank space in pixels both above and below the applet.
width
The
width
attribute is used to set the horizontal extent of the applet in pixels.
This example displays a Java applet clock.
Code:
<applet codebase="clock/classes" code="JavaClock.class" width="150" height="150">
</applet>
Output:
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information