Quantcast
Viewing latest article 12
Browse Latest Browse All 49

Javascript play sound on hover. stop and reset on hoveroff

function EvalSound(soundobj) {    var thissound=document.getElementById(soundobj);    thissound.currentTime = 0;      thissound.Play();}function StopSound(soundobj) {    var thissound=document.getElementById(soundobj);    thissound.Stop();}

This is my code to play a audio file,

onmouseover="EvalSound('sound1')" onmouseout="StopSound('sound1')"

It is currently working on hover, however when i go back to the image that it plays under it doesnt go back to the beginning, it continues playing


Viewing latest article 12
Browse Latest Browse All 49

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>