Music on/off button

G

Gaffer

Is it possible to change the following code so that the music is 'off' when
the page is loaded and the user gets the option to turn it on?



---------------------------------------------------
<script language="JavaScript"><!--
function musicOff() {
document.midi.stop()
}function musicOn() {
document.midi.play()
}


function changeButton() {
if (document.onoff.B1.value=='Turn music off') {
document.onoff.B1.value='Turn music on';
musicOff()
}
else {
document.onoff.B1.value='Turn music off';
musicOn()
}
}
//-->
</script><embed name="midi" src="psychotune.mp3" width="95" height="95"
hidden>
<form name="onoff">
<input type="button" value="Turn music off" name="B1"
onClick="changeButton()" style="color: #000000; background-color: #FFFFFF;
font-family: Tahoma; font-size: 10pt">
</form>
 

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

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,187
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top