Name

<BGSOUND> — NN n/a IE 3 HTML n/a

Synopsis

<BGSOUND>

End Tag: Optional

This Internet Explorer-only attribute lets you define a sound file that is to play in the background while the user visits the page. The element is allowed only inside the HEAD element. Several attributes were added for Version 4. With scripting, you can control the volume and how many times the sound track plays even after the sound file loads. Although an end tag is optional, there is no need for it because all specifications for the sound are maintained by attributes in the start tag.

If you are going to use this tag, I strongly recommend making the playing of a background sound a user-selectable choice that is turned off by default. In office environments, it can be startling (if not embarrassing) to have background music or sounds unexpectedly emanate from a computer. Also be aware that there is likely to be some delay in the start of the music due to download time.

Example

<BGSOUND SRC="tunes/mazeppa.mid">

Object Model Reference

IE

[window.]document.all.elementID

Attributes

BALANCE

ID

LOOP

TITLE

VOLUME

CLASS

LANG

SRC

  

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.