javascript如何在点击网站中的视频时自动停止播放背景音乐,并在视频停止后继续播放音乐?

只需使用js控件:

//播放

playBtn.onclick?=?函数(){

如果?(oAudio.paused)?{

oaudio . play();

//getElement("musicname ")。nodeValue?=?musicName

cmbg.className?=?”音乐名称”;

play TN . class name?=?“l?玩”;

play TN . set attribute(" title "," pause ");

}

不然呢?{

oaudio . pause();

cmbg.className?=?”音乐命名”;

play TN . class name?=?“l?暂停”;

play TN . set attribute(" title "," play ");

}

};html:

& lt音频?id="myAudio " >

& lt来源?Title= "孤独的病人?-?陈奕迅"?src = "/6 rooms/html/music/gdhz . MP3 " & gt;

& lt来源?Title= "心里还有什么没崩溃的?-? "may day " src = "/31005070 . MP3 " >

& lt来源?Title= "第二人生?-? "may day " src = "/30416842 . MP3 " >

& lt/audio & gt;示例:

/6rooms/html/music.php有问题继续交流!