music create
published on December 29, 2022
leave a reply
var sound1 = new Audio("sound1.mp3");
var sound2 = new Audio("sound2.mp3");
var sound3 = new Audio("sound3.mp3");
function playSound1() {
sound1.play();
}
function playSound2() {
sound2.play();
}
function playSound3() {
sound3.play();
}
document.getElementById("button1").addEventListener("click", playSound1);
document.getElementById("button2").addEventListener("click", playSound2);
document.getElementById("button3").addEventListener("click", playSound3);
0 comments: