The <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 SRC="start.wav">
The BGSOUND
element accepts the following attributes.
BALANCE=Stereo balancing
The 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=n
The CLASS
attribute is used to specify the <DIR>
element as using a particular style sheet class. See the Style Sheets topic for details.
ID=n
The 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=n
The 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.
LOOP=n
This attribute specifies how many times a sound will loop when activated. If n=-1
or LOOP=INFINITE
is specified, the sound will loop indefinitely.
SRC
This attribute specifies the address of a sound to be played.
TITLE=n
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 TITLE
attribute.
VOLUME=n
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.
Example
This page has a background soundtrack playing if you are using Internet Explorer. The code used is:
<BGSOUND SRC="../Dynamic_Documents/clouds.mid">
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.
Every <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.
<BGSOUND...>
Properties
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.
Also, the <BGSOUND>
element supports the balance, loop, src and volume properties, which directly reflect their attribute settings (see above).
<BGSOUND...>
Methods
The <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...>
Events
The <BGSOUND...>
element/object doesn't support any events
© 1995-1998, Stephen Le Hunte
See also:
Comments:
Code:
file: /Techref/language/html/ib/Media_Embedding/bgsound.htm, 19KB, , updated: 2010/3/10 05:09, local time: 2024/12/26 13:26,
3.144.1.100:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/techref/language/html/ib/Media_Embedding/bgsound.htm"> <BGSOUND></A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.