使用音频文件

时间:2016-12-17 16:39:13

标签: javascript html

当按钮正在播放音频时,我希望所有其他按钮暂停。我也希望按钮重新按下两次。有没有这样做,而不只是使用JavaScript?

<div id="sound" class="text-center">
<a onclick="this.firstChild.play()" class="btn b"><audio src="https://archive.org/download/LastChristmas_614/Wham-LastChristmas.mp3" id="audio1"></audio><i class="fa fa-file-audio-o" aria-hidden="true"></i></a>
<a onclick="this.firstChild.play()" class="btn c"><audio src="http://www.memory-of.com/uploads/backgroundmusics/bgmusic-75155-634263906597120000.mp3" id="audio6"></audio><i class="fa fa-file-audio-o" aria-hidden="true"></i></a>
<a onclick="this.firstChild.play()" class="btn d"><audio src="http://s3.amazonaws.com/puresolo-production/assets/1951/Santa_Baby.mp3" class="audio5"></audio><i class="fa fa-file-audio-o" aria-hidden="true"></i></a>
<a onclick="this.firstChild.play()" class="btn e"><audio src="http://a.tumblr.com/tumblr_lwcu7k22YT1r0mybjo1.mp3" id="audio4"></audio><i class="fa fa-file-audio-o" aria-hidden="true"></i></a>
<a onclick="this.firstChild.play()" class="btn a"><audio src="http://a.tumblr.com/tumblr_mehj3cVKqV1qm6fdbo1.mp3" id="audio3"></audio><i class="fa fa-file-audio-o" aria-hidden="true"></i></a>
<a onclick="this.firstChild.play()" class="btn f"><audio src="http://dopefile.pk/mp3embed-zqi2ez7kf6dh.mp3" id="audio2"></audio><i class="fa fa-file-audio-o" aria-hidden="true"></i></a>

https://codepen.io/evan17gr/pen/bBOaBy

谢谢!

1 个答案:

答案 0 :(得分:1)

更改你的锚标记的开始,如此分配点击和dblclick处理程序通过' call the funtion and send the Field Name (as String) PvtFldSubTotalsOn = PivotFieldSubtotalsOn("Region") ' for debug only MsgBox "Pivot Filed Region value is " & PvtFldSubTotalsOn 引用

this ...........

这些将处理事件

<a onclick="clkHandle(this)" ondblclick="dblclkHandle(this)"