ciccioriccio ha scritto:
Salve :byebye:
Vorrei inserire un sottofondo musicale midi sul mio sito con un doppio radio button (uno per fermare la musica e uno per riavviarla).
Qualcuno sa dirmi come si fa?
:book:
Non ti servono script per fare ciò che chiedi!
Utilizzando:
<embed src='music.wav' width=200 height=55 loop=true>
ti appaiono automaticamente i pulsanti Play e stop.
Comunque se vuoi una soluzione alternativa ti ho preparato questo piccolo script, che ovviamente dovrai implementare tu a seconda delle tue esigenze:
==========================
<html>
<head>
<script>
var i = 0;
function music(){
document.getElementById("msc").innerHTML="<table width=300
height=80><tr><td> </td></tr></table>"
i = i + 1;
if (i % 2 != 0){bt.value="Stop Music";document.getElementById("msc").innerHTML="<table
width=300 height=80><tr><td><embed src='music.wav' width=200 height=55
loop=true></td></tr></table>"}
if (i % 2 == 0){bt.value="Play Music !";document.getElementById("msc").innerHTML="<table
width=300 height=80><tr><td> </td></tr></table>"}
}
</script>
</head>
<body onLoad="bt.value='Play Music !';">
<span id="msc">
<table width=300 height=80><tr><td> </td></tr></table>
</span>
<br>
<input name=bt type=button onClick="javascript:music();">
</body>
</html>
==========================
Fatti un bel copia incolla in un file htm e provalo, se hai problemi.. son qui (quando posso!) :fonzie:
SaLuT!
:byebye: