Script to switch OFF sound on a page?

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi,

I know how to add a sound script to a page - but does anyone know what
script is used to create the 'Sound Off' text link on a web page? So people
can click the sound off if they choose.

Thanks,
Steve
 
Hi Steve,

The easiest way to do that is for people to simply hit the stop button in
their browser. Generally that will stop any background sounds/music from
playing.

Here's another way depending upon whether you are using frames or not:

http://www.devnewsgroups.net/group/microsoft.public.frontpage.programming/topic15260.aspx

--
Best,
Joe

Expression Web and FrontPage Forums:
http://www.timeforweb.com/frontpage/forum/

FrontPage Extensions Hosting:
http://www.timeforweb.com/frontpage/page_display.asp?pid=30
 
Steve said:
Hi,

I know how to add a sound script to a page - but does anyone know what
script is used to create the 'Sound Off' text link on a web page? So
people
can click the sound off if they choose.

I have placed a button on my site which starts/stops the music. This way the
viewer has a choice either way.

The HTML code is
<div id="sound"></div>
<input type="button" value="Play/Stop
Music"
onclick="playSound()" title="Play/Stop
Music" />

The supporting JS code can be placed in the <head> section like this
<script type="text/javascript">
function playSound(fname) {
if (!fname)
fname = "audio/minuet.mid"
var x = document.getElementById("sound")
x.innerHTML = (!x.innerHTML )
? '<embed src="' + fname + '" loop=false
autostart=true hidden>' : ''
}
</script>

The name of the sound file (after fname=) should be changed to yours
 
Back
Top