Stop background music

N

Nuno Nunes

Hi, as I can create one link in a page to stop or to initiate the background
music to web page? Thanks
 
S

Stefan B Rusynko

1) Make sure the sound files are inserted using a Named Embed tag (usually just before the </body> tag)

<embed src="soundfile.mid" name="theNoise" id="theNoise" autostart="true" loop="true" width="0" height="0" hidden align="center">

2) Insert a link to turn the sound off

<a href="javascript:killNoise();">No Sound (or insert an image here)</a>

3) Insert this one of these scripts in the HEAD section of each page

FOR FRAMED PAGES USE:
<script language="JavaScript" language="JavaScript"><!-- Hide It:
function killNoise() {
// The Embedded sound is in a framed page (frame is named "TheFrame")
parent.TheFrame.embeds['theNoise'].stop(); return false;
}
// ShowIt: --></script>

FOR UNFRAMED PAGES USE:
<script language="JavaScript" language="JavaScript"><!-- Hide It:
function killNoise() {
// The Embedded sound is in an Unframed Page
document.theNoise.stop();return true;
}
// ShowIt: --></script>

To start the sound redo a new script / link to use
parent.TheFrame.embeds['theNoise'].start() or document.theNoise.start();




| Hi, as I can create one link in a page to stop or to initiate the background
| music to web page? Thanks
|
|
 
K

Kevin Spencer

Well, unfortunately some sites do have background music, and the worst part
is that some of them don't allow you to stop the background music. However,
it's a free world. I just steer clear of those web sites.

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top