Background Sound
Question: How do I set a background sound on a Web page?
Answer:
In all audio-enabled browsers,
you can use the
EMBED
tag to play a background sound.
For example, if you want to play the file
bkground.mid
right after the browser loads the page, you can use the following
EMBED
tag:
<EMBED NAME="bkgroundID" SRC="bkground.mid"
LOOP=TRUE AUTOSTART=TRUE HIDDEN=TRUE MASTERSOUND>
To stop the background sound, call the cross-browser method
document.bkgroundID.stop()
-
try it now!
If your target browser is Microsoft Internet Explorer
(for example, in an intranet), then
you can use the Explorer-specific
BGSOUND
tag:
<BGSOUND ID="bkgroundID" LOOP=0 VOLUME="-600" SRC="bkground.mid">
Here, again,
bkground.mid
stands for the name of the sound file that you actually want to play.
JavaScripter.net.
Copyright
© 1999-2006, Alexei Kourbatov