Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8961

Sound on/off button does not work

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "Fokke Nauta" <fnautaNO@SPAMiae.nl>
Newsgroups comp.lang.javascript
Subject Sound on/off button does not work
Date Wed, 7 Dec 2011 12:46:13 +0100
Lines 51
Message-ID <9k9208FoloU1@mid.individual.net> (permalink)
X-Trace individual.net 3LNzAhp+RMRlj+UQjjbywwBnyTzZjsaIOXZBGj9XhpLNgH4A16
Cancel-Lock sha1:5Aya1lRfRFfGJUxIBbFQTtiIdbQ=
X-Priority 3
X-MSMail-Priority Normal
X-Newsreader Microsoft Outlook Express 6.00.2900.5931
X-RFC2646 Format=Flowed; Original
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.6157
Xref x330-a1.tempe.blueboxinc.net comp.lang.javascript:8961

Show key headers only | View raw


Hi all,

I searched for a sound on/off button for web pages. The script I found I 
placed in an HTML document. I adapted it only to suit a different sound file 
and to change the text on the button.
It does not work though. The original version didn't work either.
The button changes allright but the sound stays on.
Can any one help me out?

The script is underneath this post. The web page is on www.pc3.nl/test and 
is called test.htm.

Many thanks in advance for your help.

With best regards,
Fokke Nauta

Script:

In header:
----------
<script language="JavaScript">
<!--
function musicOff() {
document.midi.stop()
}
function musicOn() {
document.midi.play()
}
function changeButton() {
if (document.onoff.B1.value=='Sound off') {
document.onoff.B1.value='Sound on';
musicOff()
}
else {
document.onoff.B1.value='Sound off';
musicOn()
}
}
//-->
</script>

In body:
--------
<embed name="midi" src="Lauquette.mp3" loop="true" width=0 height=0 
hidden="true">
<form name="onoff">
<input type="button" value="Sound off" name="B1" onClick="changeButton()">
</form> 

Back to comp.lang.javascript | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Sound on/off button does not work "Fokke Nauta" <fnautaNO@SPAMiae.nl> - 2011-12-07 12:46 +0100
  Re: Sound on/off button does not work Denis McMahon <denismfmcmahon@gmail.com> - 2011-12-07 16:42 +0000
    Re: Sound on/off button does not work "Fokke Nauta" <fnautaNO@SPAMiae.nl> - 2011-12-07 19:48 +0100
      Re: Sound on/off button does not work "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-08 00:09 +0200
        Re: Sound on/off button does not work David Mark <dmark.cinsoft@gmail.com> - 2011-12-07 16:03 -0800
          Re: Sound on/off button does not work "Fokke Nauta" <fnautaNO@SPAMiae.nl> - 2011-12-08 20:23 +0100
            Re: Sound on/off button does not work Denis McMahon <denismfmcmahon@gmail.com> - 2011-12-09 00:10 +0000
              Re: Sound on/off button does not work David Mark <dmark.cinsoft@gmail.com> - 2011-12-08 16:40 -0800
            Re: Sound on/off button does not work David Mark <dmark.cinsoft@gmail.com> - 2011-12-08 16:46 -0800
    Re: Sound on/off button does not work David Mark <dmark.cinsoft@gmail.com> - 2011-12-07 15:55 -0800
  Re: Sound on/off button does not work Denis McMahon <denismfmcmahon@gmail.com> - 2011-12-09 00:41 +0000
    Re: Sound on/off button does not work "Fokke Nauta" <fnautaNO@SPAMiae.nl> - 2011-12-10 13:40 +0100

csiph-web