2013-03-22 45 views
0

這段代碼有什麼問題嗎?音頻文件不會在加載網頁時播放。jQuery fire音頻

$(document).ready(function() { 

    var audioElement = document.createElement('audio'); 
    audioElement.setAttribute('src','content/audio/tune.mp3'); 
    audioElement.setAttribute('autoplay', 'autoplay'); 
    //audioElement.load() 
    $.get(); 
    audioElement.addEventListener("load", function() { 
    audioElement.play(); 
    }, true); 

    audioElement.play(); 

    }); 
+0

哦,不,請不要downvote!複製代碼時出錯! – Ronophobia 2013-03-22 15:35:19

回答

1

缺少一個);;最後我相信。所以你關閉就緒功能。

+0

剛剛編輯!我不是一個大jQuery noob:P – Ronophobia 2013-03-22 15:36:22