2010-04-12 135 views
1

我從來沒有刪除聲音剪輯,我想通過一個事件播放。在瀏覽器中播放動態聲音剪輯

我有有像這樣一個片段文件:

if($get['0002'] == 'mu') { 
    switch($get['0000']) { 
     case 'mp3': header('Content-Type: audio/mp3'); break; 
     case 'wav': header('Content-Type: audio/x-wav'); break; 
     default: break; 
    } 
    echo file_get_contents('./folder-name/' . $get['0001'] . '.' . $get['0000']); 
    exit; 
} 

,並在頁面上我最喜歡這個按鈕;

<input type="button" value="Play Sound" onClick="EvalSound('sound1')" > 

和這個隱藏在後臺

<embed src="./?0000=wav&0001=0001&0002=mu" autostart=false width=0 height=0 id="sound1" enablejavascript="true"> 

和JS是;

<script> 
function EvalSound(soundobj) { 
    var thissound=document.getElementById(soundobj); 
    thissound.Play(); 
} 
</script> 

這似乎不工作,我相信它與PHP頭有關。有人能請我指出正確的方向,因爲它將非常感激。

回答