F
Fokke Nauta
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>
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>