单个页面上的多个音频文件javascript
mulitiple audio files javascript on single page
所以我找到了一个快速音频播放按钮的代码片段https://siongui.github.io/2012/10/12/javascript-toggle-sound-onclick/.我想合并多个音频文件,但在页面加载时,我创建的音频按钮只播放最后一个音频文件。
enter code here
播放音频您的浏览器不支持此音频格式。
<script type="text/javascript">
function toggleSound() {
var audioElem = document.getElementById('creditCardFem');
if (audioElem.paused)
audioElem.play();
else
audioElem.pause();
}
function toggleSoun() {
var audioCreditM = document.getElementById('creditCardMa');
if (audioCreditM.paused)
audioCreditM.play();
else
audioCreditM.pause();
}
</script>
<div class="audioPlayer">
<button id="player" type="button"
onclick="javascript:toggleSound();">
Play Audio
</button>
<audio id="creditCardFem">
<source src="http://www.smartaction.com/wp-content/uploads/2015/06/Financial_Services_Credit_Card_Payment_Female_Inbound.mp3" type="audio/mpeg" type="audio/mpeg">
Your browser does not support this audio format.
</audio>
</div>
<div class="audioPlayer">
<button id="player" type="button"
onclick="javascript:toggleSoun();">
Play Audio
</button>
<audio id="creditCardMa">
<source src=#">
Your browser does not support this audio format.
</audio>
</div>
在这段代码中似乎只有一个音频文件被链接到。
<audio id="creditCardMa">
在其<source src="#">
子代中没有引用。
相关文章:
- 如何播放部分音频文件
- javascript:发送带有音频文件的POST,然后重定向到新页面
- Javascript::通过HTML5音频播放器播放列表播放多个音频文件
- 正在预加载jPlayer要使用的音频文件
- 将Base64音频文件Mp3解码为可播放的Mp3
- 在播放完成之前再次单击播放音频文件
- 在 Windows 现代(地铁)UI 应用中存储图像文件和音频文件的方法是什么?
- 在 JavaScript 中对音频文件进行计时不准确
- 如何在html5/JS中只预加载音频文件的一部分
- 单个页面上的多个音频文件javascript
- 如何将timbre.js缓冲区导出为.wav或任何其他音频文件格式
- 从PHP脚本获取音频文件时,更改JavaScript音频对象的当前时间
- 如何用一个html5音频播放器播放多个音频文件
- 如何使用日期对象在特定时间激活音频文件
- 使用PHP将通过getUserMedia()和Javascript获得的音频文件上传到服务器
- 使用 Redux 播放音频文件
- 如何在javascript中转换音频文件的比特率
- 如何使用 JSON 下载音频文件
- 第二个音频文件意外循环
- 如何在html页面上使用Flash Player渲染视频/音频文件