@1002522146
        
        2019-11-25T07:44:59.000000Z
        字数 356
        阅读 426
    未分类
音频互斥
let audios = document.getElementsByTagName('audio');function pauseAll() {let self = this;[].forEach.call(audios, (i) => {// 将audios中其他的audio全部暂停i !== self && i.pause();});}[].forEach.call(audios, (i) => {i.addEventListener('play', pauseAll.bind(i));});document.getElementsByTagName 返回的 HTMLCollection 不能用foreachdocument.querySelectorAll 返回的 NodeList 可以用foreach
