I created this as a simple wait script but the most it will do is freeze the entire script for time period of seconds.
function wait(time)
{
var x = 0;
var y = time * 500000000;
while (x<y)
{
x++
}
}
What I need is a code that can delay the script so I can play a sound because my script loops and has a crap load of Alerts so the sound does not play until the script is over.
This is the script I used to play the sound:
<div id="dummy"></div>
<script type="text/javascript">
function playSound(sound)
{
if (sound==1)
{
document.getElementById("dummy").innerHTML = '<embed type="audio/mp3" src="http://ift.tt/170p3Lu" autoplay="true" hidden="true" width="0" height="0" loop="false">';
}
}
</script>
And yes, I called playSound(1) in another script.
Aucun commentaire:
Enregistrer un commentaire