我一直在研究我的 javascript 技能,但我遇到了一个问题,即单击此处时没有播放音频是我的代码。
<div class="player_container">
<button class="play_pause_button" type="button" title="Play" onclick="play_pause"></button>
<audio class="audio_player" preload="auto">
<source src="audio/test.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
<script type="text/javascript">
var content = document.getElementsByClassName('audio_player'),
play_pause = document.getElementsByClassName('play_pause_button'),
progress = document.getElementsByClassName('player_progress');
function play_pause() {
return content.play();
}
</script>