HTML The Definitive Guide (58 page)

Read HTML The Definitive Guide Online

Authors: Chuck Musciano Bill Kennedy

BOOK: HTML The Definitive Guide
12.09Mb size Format: txt, pdf, ePub

Chapter 5

Rules, Images, and Multimedia

 

5.4 Background Audio

There is one other form of inline multimedia generally available to web surfers - audio. Most browsers treat audio multimedia as separate documents, downloaded and displayed by special helper applications, applets, or plugins. Internet Explorer, on the other hand, contains a built-in sound decoder and supports a special HTML tag that lets you integrate an audio file with your document that plays in the background as a soundtrack for your page.
[Applets and Objects, 13.1]
[Embedded

Content, 13.2]

We applaud the developers of Internet Explorer for providing a mechanism that more cleanly integrates audio into HTML documents. And the possibilities with audio are very enticing. But at the same time, we caution authors that the special tags and attributes for audio don't work with other browsers, and whether this is the method that the majority of browsers will eventually support is not at all assured. So, beware.

5.4.1 The Tag

Use the tag to play a soundtrack in the background. This tag is for Internet Explorer documents only. All other browsers ignore the tag. It downloads and plays an audio file when the host HTML document is first downloaded by the user and displayed in their browser. The background sound file also will replay whenever the user refreshes the browser display.


Function:

Plays a soundtrack in the document background Attributes:

LOOP

SRC

End tag:

None

Contains:

Nothing

Used in:

body_content

5.4.1.1 The src attribute

The src attribute is required for the tag. Its value references the URL for the related sound file. For example, when the Internet Explorer user first downloads an HTML document containing the tag:

they will hear the
welcome.wav
audio file - perhaps an inviting message - play once through their computer's sound system.

Currently, Internet Explorer can handle three different sound format files: wav, the native format for PCs; au, the native format for most Unix workstations; and MIDI, a universal music-encoding
scheme (see also Table 5.1).

Table 5.1: Common Multimedia Formats and Respective Filename Extensions

Format

Type

Extension

Platform of Origin

GIF

Image

gif

Any

JPEG

Image

jpg, jpeg, jpe
Any

XBM

Image

xbm

Unix

TIFF

Image

tif, tiff

Any

PICT

Image

pic, pict

Any

Rasterfile

Image

ras

Sun

MPEG

Movie

mpg, mpeg

Any

AVI

Movie

avi

Microsoft

QuickTime Movie

qt, mov

Apple

AU

Audio

au, snd

Sun

WAV

Audio

wav

Microsoft

AIFF

Audio

aif, aiff

Apple

MIDI

Audio

midi, mid

Any

PostScript

Document
ps, eps, ai

Any

Acrobat

Document
pdf

Any

5.4.1.2 The loop attribute

Like Internet inline movies, the loop attribute for the browser's tag lets you replay a

background soundtrack for a certain number of times (or over and over again forever), at least until the user moves on to another page or quits the browser.

The value of the loop attribute is the integer number of times to replay the audio file, or infinite, which makes the soundtrack repeat endlessly.

For example:

repeats the ta-dum soundtrack ten times, whereas: continuously plays the noise soundtrack.

5.4.2 Alternative Audio Support

There are other ways to include audio in your documents, using more general mechanisms that support other embedded media as well. The most common alternative to the tag is the tag, originally implemented by Netscape and supplanted by the HTML

standard 4.0 tag. Take a look in Chapter 13 for details.

5.3 Document Colors and

5.5 Animated Text

Background Images

Chapter 5

Rules, Images, and Multimedia

 

5.5 Animated Text

In what appears to be an effort to woo advertisers, Internet Explorer has added a form of animated text to HTML. The animation is simple - text scrolling horizontally across the display - but effective for moving banners and other elements that readily and easily animate an otherwise static document. On the other hand, like the tag, animated text can easily become intrusive and abusive for the reader. Use with caution, please, if at all.

5.5.1 The Tag

The tag defines the text that scrolls across the Internet Explorer user's display.


Function:

Create a scrolling text marquee

Attributes:

ALIGN LOOP

BEHAVIOR SCROLLAMOUNT

BGCOLOR SCROLLDELAY

DIRECTION VSPACE

HEIGHT WIDTH

HSPACE

End tag:

; never omitted

Contains:

plain_text

Used in:

body_content

The tag is for Internet Explorer only, and it is an extension to the HTML 4.0 standard.

The text between the tag and its required end tag scrolls horizontally across the display. The various tag attributes control the size of the display area, its appearance, its alignment with the surrounding text, and the scrolling speed.

The tag and attributes are ignored by other browsers, but its contents are not. They are displayed as static text, sans any alignment or special treatments afforded by the tag attributes.

Other books

Awakening Amelia by Kate Pearce
Comanche Woman by Joan Johnston
Chill Factor by Rachel Caine
Priestess of the Nile by Veronica Scott
About Face by James Calder

© FullEnglishBooks 2015 - 2024    Contact for me [email protected]