100-project-100-days-website/100_projects/62-music-website/js/main.js
2023-04-24 00:15:16 +03:00
Ask

14 lines
318 B
JavaScript

{633f52f0ecdbc51cde35b39e4dcf0eb29c8c4c72 true 318 main.js 0xc002e59b20}

var song = document.getElementById("song");
var icon = document.getElementById("icon");
// icon.onclick = function(){
// song.play();
// }
icon.onclick = function(){
if (song.paused){
song.play();
icon.src = "media/pause.png";
} else{
song.pause();
icon.src = "media/play.png";
}
}