Created
February 23, 2012 03:00
-
-
Save dnoyes/1889579 to your computer and use it in GitHub Desktop.
html5 audio
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> | |
<script type="text/javascript"> | |
var a = new Audio(); | |
var sources = [ | |
'http://www.pacdv.com/sounds/fart-sounds/fart-2.wav', | |
'http://www.pacdv.com/sounds/fart-sounds/fart-3.wav', | |
'http://www.pacdv.com/sounds/fart-sounds/fart-8.wav']; | |
function playFart() { | |
var i = Math.floor(Math.random()*sources.length); | |
a.pause(); | |
a.src = sources[i]; | |
a.startTime = 0; | |
a.play(); | |
} | |
</script> | |
<style> | |
.container {width:400px; height:400px; background-color:red;} | |
</style> | |
</head> | |
<body> | |
<div class="container" onmouseover="playFart();">poop</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment