📌  相关文章
📜  javascript 播放暂停按钮 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:19.028000             🧑  作者: Mango

代码示例1
var button = document.getElementById("button");
var audio = document.getElementById("player");

button.addEventListener("click", function(){
  if(audio.paused){
    audio.play();
    button.innerHTML = "Pause";
  } else {
    audio.pause();
    button.innerHTML = "Play";
  }
});