play a sound every # of seconds
This plays a beep sound every # of seconds, to stop it just reload the page
- 4 Minutes is 240
- 4.5 Minutes is 270
- 5 Minutes is 300
HTML
<input type="text" id="a"><input type="button" class='btn btn-primary' value="sec" id="s" onclick="out()">
<audio id="player" src="/files/wow.mp3"></audio>
Javascript
function out() {
x = document.getElementById('a').value;
intrvl = setInterval("sound(x)", x*1000);
}
i = 0;
function sound(x)
{
if(x == i)
{
clearInterval(intrvl);
}
i++;
document.getElementById('player').play();
}
External Link for play a sound every # of seconds