I'm trying to make a short audio file play when a html checkbox is checked. I'm probably missing something elementary. Here is my code:
<body>
<input type="checkbox" id="cena" onchange="myfunction()"></input><label for="cena"></label>
</label><script>
function myfunction(){
var audio = new audio('rusbtaudio.mp3');
audio.play();
}
</script>
</body>
rusbtaudio.mp3
is in same folder as html file.
Aucun commentaire:
Enregistrer un commentaire