HTML Reference Guide


Tag Index| Content List| HTML FAQ

<APPLET> ... </APPLET> APPLET

Description:

The APPLET element is the mechanism to embed and invoke a Java application within an HTML document. A browser that understands this element will ignore everything in the content of the APPLET element except for embedded PARAM elements [which are used to pass parameters to the Applet.] Browsers that do not understand this element should ignore it and the embedded PARAM elements and process the content between the begin and end APPLET tags instead (this should also happen when the Applet fails to load for whatever reason.)

Attributes:

align - specifies the alignment of text following the APPLET reference relative to the applet on screen. LEFT and RIGHT specify floating horizontal alignment of the applet in the browser window, and subsequent text will wrap around the applet. The other options specify vertical alignment of text relative to the applet on the same line.

alt - indicates text to be displayed for text only browsers or browsers that do not understand the Applet element.

archive - "This attribute can improve applet download time by reducing the number of HTTP connections required to fetch applet code."

code - This attribute indicates a URL pointing to the Applet's code/class.

codebase - This attribute indicates the base URL of the applet if the CODE attribute is relative. If the CODEBASE URL is relative, it is in relation to the current document URL or the BASE HREF element, if present.

height - This attribute explicitly specifies the height of the applet in pixels. It can be used to speed up display of the document being downloaded so it can pre-render the document with an applet placeholder while the applet downloads.

hspace - This attribute specifies the horizontal spacing (left and right padding) around the applet in pixels.

mayscript - This is a stand-alone attribute which permits the applet to access Javascript functionality and data on a page. Attempts to access Javascript when this attribute is not present results in a Java exception.

name - This provides a way for the applet to identify the applet to other applets in the current HTML page.

object - "This attribute gives the name of the resource that contains a 'serialized' representation of an applet. The applet will be deserialized by the browser. The init() method will not be invoked; but its start() method will. Attributes valid when the original object was serialized are not restored. Any attributes passed to this applet instance will be available to the Applet."

vspace - This attribute specifies the vertical spacing (top and bottom padding) around the applet in pixels.

width - This attribute explicitly specifies the width of the applet in pixels. It can be used to speed up display of the document being downloaded so it can pre-render the document with an applet placeholder while the applet downloads.

Example code:

<applet CODEBASE="http://www.foo.com/java/" CODE="javaexample.class" WIDTH=200 HEIGHT=300>
<param NAME=text1 VALUE="Example Text 1">
<param NAME=imagecaption VALUE="Image Caption">
<param NAME=bounceimage VALUE="bounce1.gif">
<img SRC="non_java_image.gif" WIDTH=200 HEIGHT=300 BORDER=0 ALT="You are missing the full Java Experience.">
</applet>

Result:

You are missing the
    full Java Experience.

See Also: