0

请告诉我何时停止使用“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?
4

1 回答 1

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>
于 2012-10-08T12:18:43.543 回答