here is my Code:
<audio id="sound1" src="sound/EinE.mp3"> onmouseover="document.getElementById('sound1').play()"
Working fine. But when I leave the mouseover and return with the mouse, the sound do not replay. I have to wait, till the sound play to end. It should start by 0. Any ideas?
You should do something like this
<audio id="sound1" src="sound/EinE.mp3" onmouseover="var a = document.getElementById('sound1'); a.pause(); a.currentTime = 0; a.play()">
By just doing a.play()
, you don't restart it. To restart, you should reset the currentTime
attribute.