自动播放音频

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="jquery-1.11.3.min.js"></script>
</head>
<body>
    <!-- <audio onended="myFunction()"> -->
    <audio onended="myFunction()" class="next" controls autoplay src="http://www.jlgreen.cn/BookQRScanner/ASBook170930/audio/001.mp3 

"></audio>

</body>
</html>

<script type="text/javascript">
    function myFunction(){
        var audios=["http://www.jlgreen.cn/BookQRScanner/ASBook170930/audio/002.mp3 

","http://www.jlgreen.cn/BookQRScanner/ASBook170930/audio/003.mp3 

"];
        var i=0;
        
        if(audios[i])
        {
            $(".next").attr('src',audios[i]);
            i++;
        }else{
            alert('·ÅÍêÁË');
        }
    }
    
</script>

 

posted @ 2017-12-05 09:49  Tane  阅读(231)  评论(0编辑  收藏  举报