<BGSOUND> element allows authors to create pages that will play sound clips, or background soundtracks while the page is being viewed Sounds can either be samples (.WAV or .AU format) or MIDI (.MID format).
The HTML used to insert a background sound into a page is:
BGSOUND element accepts the following attributes.
BALANCE attribute can be used to change the stereo balance when the sound file is played. It accepts values between '-10000' and '10000'. The effect of the two extreme values depends on the sound settings on the users system, but using either of the extreme values will force the sound to play from one speaker only.
CLASS attribute is used to specify the
<DIR> element as using a particular style sheet class. See the Style Sheets topic for details.
ID attribute can be used to either reference a unique style sheet identifier, or to provide a unique name for the
<DIR> element for scripting purposes. Any
<DIR> element with an
ID attribute can be directly manipulated in script by referencing its
ID attribute, rather than working through the All collection to determine the element. See the Scripting introduction topic for more information.
LANG attribute can be used to specify what language the
<DIR> element is using. It accepts any valid ISO standard language abbreviation (for example
"en" for English,
"de" for German etc.) For more details, see the Document Localisation section for more details.
This attribute specifies how many times a sound will loop when activated. If
LOOP=INFINITE is specified, the sound will loop indefinitely.
This attribute specifies the address of a sound to be played.
The Internet Explorer 4.0 (and above) specific
TITLE attribute is used for informational purposes. The
<BGSOUND> attribute presents nothing on the screen, so no 'ToolTip' is provided by the
VOLUME attribute accepts values between '-10000' and 0 and can be used to set the volume at which the sound file will play. Note that using '0' (i.e. maximum volume), will play the sound file at 100% of the users current volume settings. There is no way in HTML that you can force a sound file to play at a volume indecent to the user. They will always have total control.
This page has a background soundtrack playing if you are using Internet Explorer. The code used is:
NOTE : Internet Explorer now fully supports use of Netscape plug-ins using the
<EMBED...> element. Therefore, using :
<EMBED SRC="../Dynamic_Documents/clouds.mid" HIDDEN="True">
will produce the same effect as using the above
<BGSOUND...> element (and will also work in Netscape (3.0 and above)). The actual
<BGSOUND...> element is still Internet Explorer specific though.
<BGSOUND> element in a document is an object that can be manipulated through scripting. Note that scripting of the
<BGSOUND> element/object is only supported by Internet Explorer 4.0, as only Internet Explorer supports the
<BGSOUND...> element/object supports all of the standard Dynamic HTML properties (i.e. className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName and title). Details of these can be found in the standard Dynamic HTML properties topics.
<BGSOUND> element supports the balance, loop, src and volume properties, which directly reflect their attribute settings (see above).
<BGSOUND...> element/object supports some of the standard Dynamic HTML methods (i.e. contains, getAttribute, removeAttribute and setAttribute). Details of these can be found in the standard Dynamic HTML Methods topics.
<BGSOUND...> element/object doesn't support any events
© 1995-1998, Stephen Le Hunte