Webpage Workshop: Home » XHTML 1.0 language reference » Applet

Applet (transitional only)

This element is used to include a Java applet in the displayed page. The applet element is only included in the transitional document type, and is deprecated in the strict document type in favor of the object element.

The applet element can contain parameter elements to adjust settings in the Java applet, and can also include other elements that are only displayed when no Java Virtual Machine is found on the client machine.

<applet
    align="bottom | left | middle | right | top"**
    alt="text"**
    archive="URL"**
    class="class name(s)"**
    code="URL"**
    codebase="URL"**
    height="pixels"**
    hspace="pixels"**
    id="unique identifier"**
    name="unique identifier"**
    object="filename"**
    style="style information"**
    title="text"**
    vspace="pixels"**
    width="pixels"**
>
</applet>

Key:
‡ = Required attribute
** = Transitional only

Explanation of attributes

align**: used to specify the position of the element in relation to content that might flow around it. The defined values are bottom, left, middle, right and top.

alt**: this attribute is used to define an alternative text to display when the element is not supported. It should be noted that this is an alternative to the element and should not be simply a description of it; it is intended to replace the element, not compliment it.

archive**: used to indicate a compressed version of the applet that may reduce the download time. This attribute should contain a URL.

class**: used to state which class(es) the element belongs to. It is possible to indicate more than one class for an element by separating each class name with a space character. This attribute is normally used in combination with a stylesheet in order to associate the elements with particular styles defined within the stylesheet.

code**: used to specify the Java class file to be loaded in order to execute the applet. This may be an absolute URL, eg. http://www.example.com/applet.class, or a URL relative to the value of the codebase attribute, eg. applet.class.

codebase**: used to specify the directory in whcih the Java class files are stored. This may be an absolute or a relative URL.

height**‡: used to specify the height of the element in pixels, when the value is a number, or when the value is followed by the % symbol it denotes a percentage of the available page canvas to use as a height.

hspace**: used to specify a horizontal padding. A space of the number of pixels specified in this attribute is left on the right and left sides of the element.

id**: used to specify a unique alphanumeric identifier to the element. This is usually used in combination with stylesheets in order to apply a style to one particular instance of an element. Only one element, regardless of type, can be given a particular id.

name**: used to assign a name to the applet so that it can be accessed by external scripts.

object**: used to specify a URL that is a serialized representation of the applet.

style**: used to specify an inline style to apply to the element. The styles defined here override the styles declared in the header section.

title**: used to define an advisory text that may be displayed as a tooltip when a mouse is used to hover over the element.

vspace**: used to specify the vertical spacing. A space of the number of pixels specified in this attribute is left on the top and bottom sides of the element.

width**‡: used to specify the width of the element in pixels, when the value is a number, or when the value is followed by the % symbol it denotes a percentage of the available page canvas to use as a width.

Event handlers

No event handlers are defined for this element.

Compatibility

Description: Support of applet and attributes in various browsers
Test Internet Explorer 6+ Netscape 4 Mozilla and Netscape 6+ Opera 6+ MSN TV (WebTV) Konqeuror 3.0+
Basic element support  Yes  Yes  Yes  Yes  No  Yes 
Attribute: align  Yes  Yes  Yes  Yes  No 
Attribute: alt  Yes  Yes  Yes  No  No 
Attribute: archive  Yes  Yes  Yes  No  No 
Attribute: class  Yes  Yes  Yes  No  No 
Attribute: code  Yes  Yes  Yes  Yes  No  Yes 
Attribute: codebase  Yes  Yes  Yes  No  No 
Attribute: height  Yes  Yes  Yes  Yes  No  Yes 
Attribute: hspace  Yes  Yes  Yes  Yes  No  Yes 
Attribute: id  Yes  Yes  Yes  No  No 
Attribute: name  Yes  Yes  Yes  Yes  No  Yes 
Attribute: object  No  No  No  No 
Attribute: style  Yes  Yes  Yes  Yes  No 
Attribute: title  No  No  No  No  No  No 
Attribute: vspace  Yes  Yes  Yes  Yes  No 
Attribute: width  Yes  Yes  Yes  Yes  No  Yes 

Key:
The browser icons are explained in the below list:
Internet Explorer 6+ = Microsoft Internet Explorer 6+
Netscape 4 = Netscape Communicator 4
Mozilla and Netscape 6+ = Mozilla and Netscape Navigator 6+
Opera 7+ = Opera 7+
MSN TV (WebTV) = MSN TV (aka. WebTV)
Konqeuror 3.0+ = Konqueror 3.0+