onMouseOver sound not working for some mystery reason
Posted: Sat Nov 08, 2003 8:26 am
Building a site for a mate as a favour. I did get a onMouseOver hover sound to work then lost the file!
This will now not work but should! I think I'll die before I solve this...please please help!!!
In the head section
In the body section:
In the head section
Code: Select all
<script type="text/javascript">
<!--
var tmr = null, ebd = null;
function makeSound(file) {
if (!ebd) {
var snd = document.createElement('embed');
snd.setAttribute("name", "hoversound");
snd.setAttribute("id", "hoversound");
snd.setAttribute("src", "file");
snd.setAttribute("autostart", "true");
snd.setAttribute("loop", "true");
snd.setAttribute("volume", "150");
snd.setAttribute("hidden", "true");
document.getElementById("sound-holder").parentNode.appendChild(snd);
if (tmr) {
clearTimeout(tmr);
}
tmr = setTimeout('killSound()', 2000);
ebd = true;
}
else {
clearTimeout(tmr);
killSound();
return makeSound(file);
}
}
function killSound(){
document.getElementById("sound-holder").parentNode.removeChild(document.embedsї'hoversound']);
emd = null;
}
//-->
</script>Code: Select all
<span id="sound-holder">
<a href="http://www.unitedartcity.co.uk/phpBB2/index.php" onMousOver="makeSound('amazing.wav');">
test</a>
</span>