Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


APPLET Element: Include an Embedded Applet

Usage: <APPLET> ... </APPLET>
Can Contain: ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, DL, FIELDSET, FORM, Hn, HR, [ISINDEX], MENU, NOFRAMES, NOSCRIPT, OL, P, PRE, TABLE, UL,
Can Contain: PARAM,
characters, character highlighting, A, APPLET, BASEFONT, BR, BUTTON, IFRAME, IMG, INPUT, LABEL, MAP, OBJECT, SCRIPT, SELECT, TEXTAREA
Can Be Inside: ADDRESS, BLOCKQUOTE, BODY, CAPTION, CENTER, DD, DIV, DT, FIELDSET, FORM, Hn, LI, NOFRAMES, NOSCRIPT, P, TD, TH,
character highlighting, A, APPLET, BUTTON, IFRAME, LABEL, LEGEND, OBJECT
Attributes: CLASS, ID, STYLE, TITLE, (onBlur, onFocus: Internet Explorer 4 only),
ALIGN, ALT, ARCHIVE, CODE, CODEBASE, HEIGHT, HSPACE, MAYSCRIPT (Netscape only), NAME, OBJECT,, VSPACE, WIDTH

APPLET is used to include an inline applet—at present, Java applets are the only supported cases. The attribute CODE specifies the URL at which the applet is located (analogous to the SRC attribute of the IMG element), while the attributes WIDTH and HEIGHT specify the height and width required by the applet, in pixels. Parameter values required by the applet are obtained from PARAM elements contained within the APPLET element. An example showing the use of APPLET was given in Example 12 in Chapter 2. The following is another, simple example:

<APPLET CODE="HuntingMammoths.class" WIDTH="300" HEIGHT="300">
    <PARAM NAME="x_offset" VALUE="0.224">
    <PARAM NAME="image" VALUE="images/hairy_mammoth.gif">
    <PARAM NAME="weapon" VALUE="rubber biscuit">
</APPLET>


NOTE:  APPLET to Be Replaced by OBJECT

APPLET has some annoying limitations and is destined to be replaced by the OBJECT element. OBJECT, which is supported by Internet Explorer 3/4 and Netscape Navigator 4, is discussed in Chapter 7.


The supported attributes and their meanings are:

ALIGN=“top,” “middle,” “bottom,” “left,” “right” (optional) Specifies the alignment of the applet with respect to the surrounding text. The values “top,” “middle,” and “bottom” align the top of the applet with the top of the text, the middle of the applet with the middle of the text, and the bottom of the applet with the bottom of the text, respectively. The values “left” and “right” let the applet float to the left and right margins, respectively, and enable text flow around the applet frame.
ALT=“string” (optional) Specifies a text string to be use in place of the applet by browsers that are unable to run the applet.
ARCHIVE=“url” (optional; not supported by Internet Explorer 3) Specifies an uncompressed ZIP-format archive of classes. If specified, the browser will download the specified ZIP file and will search there for the CODE-specified applet and supporting classes. Classes not in the ZIP file will still be accessed from the server, following the traditional manner.
CODE=“url” (optional; one of CODE or OBJECT must be present) Specifies the URL of the applet to be run. If referencing an applet from your local computer, this must point to a file with a name ending in .class. Internet Explorer 4 will not recognize applets if the names end in .cla—thus you cannot load local applets if you are using Windows 3.1.
CODEBASE=“url” (optional, depending on CODE value) Specifies the code base for the applet selected by the CODE attribute, where the code base is simply the directory or location containing any supporting class libraries required by the applet. If the supporting libraries are at the same location as the program itself, then CODEBASE can be omitted.
HEIGHT=“number” (mandatory) Specifies the height required of the embedded applet, in pixels. This is required, as a browser has no other way of knowing how big the applet is.
HSPACE=“number” (optional) Specifies a padding space, in pixels, to be left to the left and right of the applet. This creates an extra space between the applet and the surrounding document. This is not supported by Netscape Navigator.
MAYSCRIPT (optional; Netscape Navigator 3+ only) Lets the applet communicate with JavaScript programs running in the browser, and vice versa. If absent, then JavaScript programs cannot communicate with the applet.
NAME=“string” (optional) Specifies a name which identifies the applet for external reference. This lets other programs (such as script programs within the document) reference and communicate with the named applet.
OBJECT=“url” (optional; one of CODE or OBJECT must be present; not currently supported) Specifies a resource containing a serialized representation of an applet’s state, but not the code implementation. The location is determined relative to the URL specified by CODEBASE. The serialized data contains the applet’s class name—the browser must use this name to retrieve the implementation from a class file or archive. The browser will then combine the class and the serialized data to restart the applet.
Note that one of CODE or OBJECT must be specified. Both may be specified, but it is an error if they reference different class names.
VSPACE=“number” (optional) Specifies a padding space, in pixels, to be included above and below the applet. This creates an extra space between the applet and the surrounding document. This is not supported by Netscape Navigator.
WIDTH=“number” (mandatory) Specifies the width required of the embedded applet, in pixels. This is required as a browser has no other way of knowing the appropriate size for the applet region.

PARAM Element: Define an Applet Parameter

Usage: <PARAM>
Can Contain: empty
Can Be Inside: APPLET, OBJECT
Attributes: ID, NAME, TYPE, VALUE, VALUETYPE


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.