如何在不顯示播放器的情況下創建文本超鏈接到mp3文件。例如,如果我在我的網站上有「播放」一詞並點擊了它,則相關聯的mp3將播放而不離開該網頁並且沒有可見的播放器。另外,當右鍵單擊時,該人員可以選擇保存/下載文件。我找到的最接近的例子只允許您複製鏈接位置,而不是下載/保存mp3文件。謝謝。超鏈接文本到mp3而不顯示播放器
<!--[ In the head section of the HTML ]-->
<!--audio-->
<script type="text/javascript">
function play_single_sound() {
document.getElementById('audiotag').play();
}
</script>
<!--/audio-->
<!--[ In the body section of the HTML ]-->
<!--embedded audio-->
<div id="audio">
<audio id="audiotag" src="http://sample.mp3" autobuffer="autobuffer"></audio>
</div>
<!--/embedded audio-->
<!--button/link-->
<a href="javascript:play_single_sound();">play</a>
<!--/button/link-->
<!--[ Optional CSS ]-->
div#audio {
display: none;
overflow: hidden;
}
加載一個iFrame的寬度內的MP3:0和高度:0 – esdebon