I’m making a soundboard dupe of YouTube in my classes of webdesign and I can’t figure out how to code a button to stop all the sounds playing. I think it has something to do with the way I coded the function that makes the sounds play, but I really don’t know how to change it in a way that makes it work.
So this is my code in Javascript:
function speelGeluid(welkGeluid){
var audiootje = "Audio/" + welkGeluid;
var audio = new Audio(audiootje);
audio.play();
}
And an example of the HTML part:
<div class="videotje" id="FunkyFrog1" onclick="speelGeluid ('TacoBell.mp3')"></div>
It took me and my teacher a few tries to figure out what works for playing the audio as well, but I don’t know I can stop the sounds once they’re playing. Everything I’ve tried has just made the entirety of the Javascript not work
Joe Mamma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.