<BGSOUND> | NN n/a IE 3 HTML n/a | |||
<BGSOUND> | HTML 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. 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. Only the id attribute is shared with other elements. If you are going to use this tag, I strongly recommend making the 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 | ||||
[window.]document.getElementById(elementID)
|
||||
Element-Specific Attributes | ||||
|
||||
Element-Specific Event Handler Attributes | ||||
None. |
balance | NN n/a IE 4 HTML n/a |
balance="signedInteger" | Optional |
A value that directs how the audio is divided between the left and right speakers. Once this attribute value is set in the element, its value cannot be changed by script control. |
|
Example | |
<BGSOUND src="tunes/mazeppa.mid" balance="+2500"> |
|
Value | |
A signed integer between -10,000 and +10,000. A value of 0 is equally balanced on both sides. A negative value gives a relative boost to the left side; a positive value boosts the right side. |
|
Default | |
0 |
|
Object Model Reference | |
[window.] document.getElementsByTagName("bgsound")[0].balance |
lang | NN 3 IE 4 HTML 4 |
lang="languageCode" | Optional |
The language being used for the element's attribute values and content. A browser can use this information to assist in proper rendering of content with respect to details such as treatment of ligatures (when supported by a particular font or required by a written language), quotation marks, and hyphenation. Other applications and search engines might use this information to aid the selection of spell-checking dictionaries and the creation of indices. |
|
Example | |
<SPAN lang="de">Deutsche Bundesbahn</SPAN> |
|
Value | |
Case-insensitive language code. |
|
Default | |
Browser default. |
|
Object Model Reference | |
[window.]document.getElementById(elementID).lang
|
loop | NN n/a IE 3 HTML n/a |
loop="integer" | Optional |
Defines the number of times the sound plays. If the attribute is absent or is present with any value other than -1, the sound plays at least once. Assigning a value of -1 means that the sound plays until the page is unloaded. Contrary to Microsoft's Internet Explorer SDK information, there does not appear to be a way to precache the sound without having it start playing. |
|
Example | |
<BGSOUND src="tunes/mazeppa.mid" loop="3"> |
|
Value | |
No value assignment necessary for a single play. A value of 0 still causes a single play. Values above zero play the sound the specified number of times. Assign -1 to have the sound play indefinitely. |
|
Default | |
-1 |
|
Object Model Reference | |
[window.] document.getElementsByTagName("bgsound")[0].loop |
src | NN n/a IE 3 HTML n/a |
src="URL" | Optional |
A URL that points to the sound file to be played. The type of sound file that can be played is limited only by the audio facilities of the browser. Common audio formats, including MIDI, are supported in Internet Explorer without further plugin installation. |
|
Example | |
<BGSOUND src="tunes/beethoven.mid"> |
|
Value | |
Any valid URL, including complete and relative URLs. The file must be in a MIME type supported by Internet Explorer or a plugin. |
|
Default | |
None. |
|
Object Model Reference | |
[window.] document.getElementsByTagName("bgsound")[0].src |
volume | NN n/a IE 4 HTML n/a |
volume="signedInteger" | Optional |
An integer that defines how loud the background sound plays relative to the maximum sound output level as adjusted by user preferences in the client computer. Maximum volumea setting of zerois only as loud as the user has set in the Sound control panel. Attribute adjustments are negative values as low as -10,000 (although most users lose the sound at a value much higher than -10,000). |
|
Example | |
<BGSOUND src="tunes/beethoven.mid" volume="-500"> |
|
Value | |
A signed integer value between -10,000 and 0. |
|
Default | |
0 |
|
Object Model Reference | |
[window.] document.getElementsByTagName("bgsound")[0].volume |