Phuket IT

Computer => Web Site => Topic started by: aegkaluk on 16, 11, 2011, 14:58:05

Title: javascript function play audio files
Post by: aegkaluk on 16, 11, 2011, 14:58:05
Code: [Select]
<script language="JavaScript">

function play(file) {
    var embed = document.createElement("embed");
 
    embed.setAttribute('src', file);
    embed.setAttribute('hidden', true);
    embed.setAttribute('autostart', true);
 
    document.body.appendChild(embed);
}

$(document).ready(function() {
   
   
    play("../sounds/ALARM2.WAV");
    alert("Demo");
});   
   


</script>