Tutorial 12: Embed with HTML - Page 5 - HTML with Style | WebReference

Tutorial 12: Embed with HTML - Page 5 - HTML with Style


Tutorial 12: Embed with HTML - Page 5

Other than alternate content, the OBJECT element can also contain any number of PARAM elements. These elements are used to supply parameters to the applet or program being embedded, if these are required. The specific number and type of parameters needed depends on the object you're embedding. Java applets make heavy use of parameters. For instance, a Java applet that plays a sound file might require a parameter that supplies the URI of the sound file.

The PARAM element

Can only appear inside OBJECT and APPLET elements
Empty element
Empty element. THe start-tag is required and the end-tag is forbidden.

Attributes for the PARAM element

name (text)
The name of the parameter.
value (text)
The value of the parameter.
valuetype (value type)
The type of the value specified. This can either be data, in which case it's just textual data, ref, in which case the value is a URI, or object, in which case the value is a pointer to another OBJECT element in the document. The details of these values depend on the type of object you're using.
type (content type)
If valuetype is ref, specifies the MIME content type of the resource specified by the parameter value.
Identifier and classification attributes

Using OBJECT for embedding applets and other programs into Web pages is still a rather theoretical endeavor, as the HTML specification leaves the details to be largely implementation-dependent. Since this doesn't actually work yet, I won't go into it quite yet. Instead, let's forget about OBJECT for now and concentrate on the more real-world alternatives: IMG and APPLET.

The IMG element

The IMG element

IMG is an inline element.
IMG is an empty element.
Empty element. Start tag is required, end tag is forbidden.

Attributes for the IMG element

src (URI)
The location of the image.
longdesc (text)
A long description of the image.
Alternative text attributes
Attributes for specifying image maps
Object presentational attributes
Identifier and classification attributes
Title attribute
Language information attributes
Inline style information attribute
Intrinsic event handler attributes

Alternative text attributes

alt (text)
Text that should be displayed by the user agent if the element itself cannot be rendered.

The IMG element is used to embed images in HTML documents. The SRC attribute gives the image's location. It's really as simple as that.

The ALT attribute provides a mean to set alternate text for the image, much like to contents of the OBJECT element. The problem with this method is that the alternate content can only be text. Hence, you cannot have the complicated set of alternatives we saw in our previous example. You can also specify the LONGDESC attribute that gives a long description for the image that user agents could make available to the user if they can't display the image. Here's our example using IMG instead of OBJECT:

<H1><IMG SRC="acmelogo.foo" ALT="Acme Computer Corp."> Q3
<P>Our third-quarter results are out. The cocktail party to celebrate
was just as successful as Q3 itself. Here's a picture of our beloved
CEO, Dr. Propellerhead, with the VP for Marketing:</P>
<P><IMG SRC="arnyandstan.foo"
ALT="A picture of Arny and Stan smiling for the camera."></P>
<P>The data below shows that our Transfirbulation department has been
making some good progress:</P>
 ALT="Third quarter earnings by department"
 LONGDESC="A pie chart showing Q3 earnings broken down by
department. The data shows that the Transfirbulation department was
responsible for almost 75% of all earnings this quarter."


Produced by Stephanos Piperoglou

URL: http://www.webreference.com/html/tutorial12/5.html

Created: May 28, 1998
Revised: February 25, 1999