100-project-100-days-website/100_projects/62-music-website/js/main.js

14 lines
318 B
JavaScript
Raw Normal View History

2023-04-24 00:15:16 +03:00
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";
}
}