Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #8961
| From | "Fokke Nauta" <fnautaNO@SPAMiae.nl> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Sound on/off button does not work |
| Date | 2011-12-07 12:46 +0100 |
| Message-ID | <9k9208FoloU1@mid.individual.net> (permalink) |
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 | Next — Next in thread | Find similar | Unroll 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