PDA

View Full Version : Mouseover Button Sound help



cisebna
10-12-2011, 03:13 AM
Hello,

I will not be the first or last to post a dumb question as their 1st post but I have searched everywhere and i cant seem to find a solution that might be simple but I dont know what im doing.

Anyways I have this halloween webpage im making and it has a background music embeded as a mp3 right?

ok so one of the buttons I have I want it to make a mouse over effect that when the mouse is over a monsters face shows all over the screen and I want a sound of screaming to go off once the mouse is over the button


so I have the monster part but I cant seem to get the scream sound to start. heres the codes i have so far

java script




<script type="text/javascript">
<!--
function ShowObject(id, flag)
{
var elem=document.getElementById(id);
if(elem)
elem.style.visibility=flag?'visible':'hidden';
}


//-->
</script>


<script language="JavaScript1.4" type="text/javascript">
<!--
function jsPlay(soundobj) {
var thissound= eval("document."+soundobj);
try {
thissound.Play();
}
catch (e) {
thissound.DoPlay();
}
}
//-->
</script>



and html:



<div id="pictures" style="position:absolute;left:107px;top:187px;width:88px;height:20px;text-align:left;z-index:5;">
<a href="./pictures.html" onmouseover="ShowObject('monster8', 1); jsPlay('scream');return false;" onmouseout="ShowObject('monster8', 0);return false;"><img src="images/crest_09.png" id="Image4" alt="" border="0" style="width:88px;height:20px;"></a></div>

<div id="scream" style="position:absolute;left:158px;top:1091px;width:91px;height:39px;text-align:left;z-index:8;">
<embed src="hal-scream.wav" id="scream" border="0" autostart="true" loop="false" hidden="true" width="91" height="39">
</div>




I dont know what Im doing wrong, i got the codes from other website, the background music plays but the scream wont start when hover, if i put hidden = false the scream and bg music just starts together

what am i doing wrong? :(