wordpress - mulitiple audio files javascript on single page -
so found snippet of code quick audio play button https://siongui.github.io/2012/10/12/javascript-toggle-sound-onclick/. want incorporate multiple audio files on page load, audio buttons created play last audio file. enter code here
play audio browser not support audio format.
<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"> browser not support audio format. </audio> </div> <div class="audioplayer"> <button id="player" type="button" onclick="javascript:togglesoun();"> play audio </button> <audio id="creditcardma"> <source src=#"> browser not support audio format. </audio> </div>
seems 1 audio file linked in code.
<audio id="creditcardma">
has no reference in <source src="#">
child.
Comments
Post a Comment