Created
May 14, 2020 15:09
-
-
Save mihkell/4154bb2f3f35ca9513f7b774ad8766b9 to your computer and use it in GitHub Desktop.
Plays sound after x seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script> | |
function out() { | |
x = document.getElementById('a').value; | |
intrvl = setInterval("sound()", x*1000); | |
} | |
function sound() | |
{ | |
document.getElementById('player').play(); | |
} | |
</script> | |
Repeat sound every x seconds | |
<input type="text" id="a"> | |
<input type="button" value="sec" id="s" onclick="out()"> | |
<audio id="player" src="https://www.soundjay.com/human/sounds/bone-crack-1.mp3"></audio> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment