请在使用“media_audio_player”类停止所有元素音频时告诉我
example:
<audio src="./ConcertMedia/'.$i2['file'].'" class="media_audio_player"> </audio>
<audio src="./ConcertMedia/'.$i2['file'].'" class="media_audio_player"> </audio>
<audio src="./ConcertMedia/'.$i2['file'].'" class="media_audio_player"> </audio>
i want use code $('.media_audio_player').get(0).pause(); but he doesnt work...
Why not work code and what me need doing?
答案 0 :(得分:0)
请根据应用于音频标签的类检查播放声音的代码。
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
function playerClicked() {
audio=$(".audioplayer").get(1);
debugger;
audio.load()
if(audio.paused){
audio.play();
} else {
audio.pause();
}
}
</script>
</head>
<body>
<a id ="storyplayer" href="javascript:playerClicked();">
Click here to play.
</a>
<audio class ="audioplayer">
<source src="sound/siol.mp3" type="audio/mpeg" >
</audio>
<audio class ="audioplayer">
<source src="sound/siol.mp3" type="audio/mpeg" >
</audio>
</body>
</html>