In the following example, run-time data for the rendering
mechanism's "Init_values" parameter is specified as an external resource
(a GIF file). The value of the
valuetype
attribute is thus set to "ref", and the
value is a URL designating
the resource.
<OBJECT classid="http://www.gifstuff.com/gifappli"
牋牋牋 standby="Loading Elvis...">
<PARAM name="Init_values"
牋牋牋 value="./images/elvis.gif">
牋牋牋 valuetype="ref">
</OBJECT>
Note that we have also set the
standby
attribute so that the user agent may render a message while the rendering
mechanism loads.
Rendering mechanisms are located by URLs. As we discussed in the section
on In the following example, we insert a Java applet
into an HTML document.
<OBJECT classid="java:program.start">
</OBJECT>
By setting the
codetype
attribute, a user agent can decide whether to retrieve the Java application
based on its ability to do so.
<OBJECT codetype="application/octet-stream"
牋牋牋牋牋 classid="java:program.start">
</OBJECT>
Some rendering schemes require additional information to identify their
implementation and must be told where to find that information. You may
give path information to the rendering mechanism via the
codebase
attribute.
<OBJECT codetype="application/octet-stream"
牋牋牋牋牋 classid="java:program.start">
牋牋牋牋牋 codebase="http://foooo.bar.com/java/myimplementation/"
</OBJECT>
The following example specifies (with the
classid
attribute) an ActiveX rendering mechanism via a URL that begins with the
protocol information "clsid". The
data
attribute locates the data to render (another clock).
<OBJECT classid="clsid:663C8FEF-1EF9-11CF-A3DB-080036F12502"
牋牋牋牋牋 data="http://www.acme.com/ole/clock.stm">
This application is not supported.
</OBJECT>
Object declarations and instantiations
The preceding examples have only illustrated isolated object definitions.
When a document is to contain more than one instance of the same object,
it is possible to separate the declaration of the object from its instantiations.
Doing so has several advantages:
-
Data may be retrieved from the network by the user agent one time
(during the declaration) and reused for each instantiation.
-
It is possible to instantiate an object from a different location in the
document, for example, by activating a link.
-
It is possible to specify objects as run-time data for other objects.
To declare an rendering mechanism so that it is not executed when read
by the user agent, set the boolean
declare
attribute in the
OBJECT
element. At the same time, you must identify the declaration by setting
the
id attribute in the
OBJECT
element to a unique value. Later instantiations of the object will
refer to this identifier.
A rendering mechanism defined with the declare
attribute is instantiated every time the OBJECT
is referenced thereafter.
In the following example, we declare an
OBJECT
and cause it so be instantiated by referring to it from a link. Thus, the
object can be activated by clicking on some highlighted text, for example.
<OBJECT declare
牋牋牋牋牋 id="earth_declaration"?
牋牋牋牋牋 data="TheEarth.mpeg"?
牋牋牋牋牋 type="application/mpeg">
?<OBJECT src="TheEarth.gif">
牋 The <STRONG>Earth</STRONG> as seen from space.
?</OBJECT>
</OBJECT>
...later in the document...
Click to see a neat <A href="#earth_declaration">
animation of The Earth!</A>
The following example illustrates how to specify run-time
values that are other objects. In this example, we send text (a poem, in
fact) to a hypothetical mechanism for viewing poems. The rendering mechanism
recognizes a run-time parameter named "font" (say, for rendering the poem
text in a certain font). The value for this parameter is itself an object
that inserts (but does not render) the font object. The relationship between
the font object and the poem viewer object is achieved by (1) assigning
the
id "tribune" to the font
object declaration and (2) referring to it from the
PARAM
element of the poem viewer object (with
valuetype
and
value).
<OBJECT declare
牋牋 id="tribune"
牋牋 type="application/x-webfont"
牋牋 data="tribune.gif">
</OBJECT>
...view the poem in KublaKhan.txt here...
<OBJECT classid="http://foo.bar.com/poem_viewer"?
牋牋牋牋牋 data="KublaKhan.txt">
<PARAM name="font" valuetype="object" value="#tribune">
<P>You're missing a really cool poem viewer ...
</OBJECT>
User agents that don't support the
declare
attribute must render the contents of the
OBJECT
declaration.
Object alignment
The align attribute has been deprecated for this element in
favor of style sheets.
The align attribute specifies the position of an object with
respect to its context.
The following values place an object in the heart of text:
-
texttop: means the top of the object should be vertically aligned
with the top of the current text line.
-
middle: means the middle of the object should be vertically aligned
with the current baseline.
-
textmiddle: means the middle of the object should be vertically
aligned with the position midway between the baseline and the x-height
for the current font. The x-height is defined as the top of a lower case
x in Western writing systems. If the text font is an all-caps style, user
agents should use the height of a capital X. For other writing systems,
user agents should align the middle of the object with the middle of the
text.
-
baseline: means the bottom of the object should be vertically
aligned with the current baseline.
-
textbottom: means the bottom of the object should be vertically
aligned with the bottom of the current text line.
Three other values,
left,
center, and
right,
cause an object to float. They are discussed in the section on
Including an image: the?A NAME="edef-IMG">
IMG
element
<!-- To avoid problems with text-only UAs you need to provide
牋牋 a description with ALT, and avoid server-side image maps -->
<!ELEMENT IMG - O EMPTY牋牋?--?Embedded image -->
<!ATTLIST IMG
?%attrs;牋牋牋牋牋牋牋牋牋牋牋牋?-- %coreattrs, %i18n, %events --
?src牋牋牋牋 %URL牋牋牋 #REQUIRED -- URL of image to embed --
?alt牋牋牋牋 CDATA牋牋?#IMPLIED?-- description for text only browsers --
?align牋牋牋 %IAlign牋?#IMPLIED?-- vertical or horizontal alignment --
?height牋牋?%Pixels牋?#IMPLIED?-- suggested height in pixels --
?width牋牋牋 %Pixels牋?#IMPLIED?-- suggested width in pixels --
?border牋牋?%Pixels牋?#IMPLIED?-- suggested link border width --
?hspace牋牋?%Pixels牋?#IMPLIED?-- suggested horizontal gutter --
?vspace牋牋?%Pixels牋?#IMPLIED?-- suggested vertical gutter --
?usemap牋牋?%URL牋牋牋 #IMPLIED?-- use client-side image map --
?ismap牋牋牋 (ismap)牋?#IMPLIED?-- use server-side image map --
?>
Start tag: required, End tag: forbidden
Attribute definitions
?
-
src = align = bottom|middle|top|left|right
-
Deprecated. This attribute specifies the position of the image with
respect its surrounding context. Its values are explained in the section
on image alignment.
Attributes defined elsewhere
-
id, class
(document-wide identifiers)
-
alt (alternate
text)
-
lang (language
information), dir (text
direction)
-
title (element
titles)
-
style (inline
style information)
-
onclick, ondblclick,
onmousedown,
onmouseup,
onmouseover,
onmousemove,
onmouseout,
onkeypress,
onkeydown,
onkeyup (intrinsic
events)
-
ismap, usemap
(client side image maps)
-
name (border,
hspace, vspace (visual presentation
of objects, images, and applets)
The
IMG element embeds an
image in the current document at the location of the element's definition.
However, we recommend using the
OBJECT
element to insert an image into a document.
The height and width attributes of this element override
the natural height and width of the source image. User agents should scale
the image appropriately.
In an earlier example, we defined a link to a family
photo. Here, we insert the photo directly into the current document
...preceding text...
I just returned from vacation! Here's a photo of my family at the lake:
<IMG src="http://www.somecompany.com/People/Ian/vacation/family.png"
牋牋 alt="A photo of my family at the lake.">
This may be expressed with the
OBJECT
element as follows:
...preceding text...
I just returned from vacation! Here's a photo of my family at the lake:
<OBJECT data="http://www.somecompany.com/People/Ian/vacation/family.png"
牋牋牋?type="image/png">
A photo of my family at the lake.
</OBJECT>
The
alt attribute specifies
alternate text when the image cannot be displayed (see below for information
on
how to specify alternate text ).
Image alignment
The align attribute has been deprecated for this element in
favor of style sheets.
The align attribute specifies the position of an object with
respect to its context.
The following values place an object in the heart of text:
-
bottom: means that the bottom of the image should be vertically
aligned with the current baseline. This is the default value.
-
middle: means that the center of the image should be vertically
aligned with the current baseline.
-
top: means that the top of the image should be vertically aligned
with the top of the current text line.
Two other values,
left and
right, cause the image to
float. They are discussed in the section on
Differing interpretations of align.
Existing user agents vary in their interpretation of the align
attribute. Some only take into account what has occurred on the text line
prior to the element, some take into account the text on both sides of
the element.