A Complete Guide to Web Design

(やまだぃちぅ) #1
Adding Plug-in Media with <embed> 165

ObjectsImages &

Adding Plug-in Media with <embed>

Web Design in a Nutshell, eMatter Edition

codebase
This tells the browser in which directory to find the applets. If the applets are
in the same directory as the page, thecodebase attribute is not necessary.


width andheight
These specify the pixel dimensions of the “window” the applet will occupy.
These attributes are required for the Java applet to function properly.


Thetag can also take many of the same attributes used for images, such
asalt(for providing alternative text if the applet can not be displayed),align
(for positioning the applet in the flow of text), andhspace/vspace(used in
conjunction withalign).


Special parameters for the applet are provided by any number of parameter tags
(sometimes there are none). Thetag always contains the name of the
parameter (name=) and its value (value=). Parameters provide special settings and
controls that are specific to the particular applet, so you need to follow the param-
eter coding instructions provided by the programmer of the applet.


Adding Plug-in Media with


Thetag places a media object, such as a Flash movie or the controls for
a RealAudio track, on a web page. It displays the media object in a rectangular
area that behaves much like an inline image in terms of positioning in the flow of
the text. Thetag was originally created by Netscape for use with plug-in
technologies. It is currently supported by both browsers; however, the HTML 4.0
Specification prefers the use of the all-purposetag for the placement of
multimedia elements.


When the browser encounters thetag, it matches the suffix of the file
name (Netscape also looks for the value of thetypeattribute) with the appro-
priate plug-in.


The following is a very simple example of the tag:


<EMBED SRC="url" HEIGHT="165" WIDTH="250" ALIGN="right"
HSPACE="6">
</EMBED>

Thesrcattribute is required to tell the browser the location of the media file to be
played. Many media types require that thewidthandheightvalues (the dimen-
sions of the plug-in element in pixels) be specified in order for the plug-in to
function.


If you are triggering plug-in functions from a script, you will need to give the
element a name using thename attribute.


Like images, media objects can be positioned using thealignattribute and its
relatedhspaceandvspacesettings. In Internet Explorer, you can also specify
alternative text with the familiaralt attribute.


There are a few special attributes that are only supported by version 4.0 browsers
that you might also want to include. To hide the media file or object from view,
use the hidden attribute with a value of “yes.” The pluginspage attribute
provides the URL of a page where the user can download information for the