<BGSOUND>NN n/a   IE 3   HTML n/a
<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
BALANCENN 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
IE [window.] document.all.tags("bgsound")[0].balance
LOOPNN n/a   IE 3   HTML n/a
LOOP=integerOptional
 

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
IE [window.] document.all.tags("bgsound")[0].loop
SRCNN 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
IE [window.] document.all.tags("bgsound")[0].src
VOLUMENN 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 volume--a setting of zero--is 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
IE [window.] document.all.tags("bgsound")[0].volume
Hosted by uCoz