views:

483

answers:

3

Hi,

I'm looking for a a mouseover sound script (for button). I plan to use wav sound but can be other sound format.

Those I have found on the net are not compatible with new browser version. Especially need to work in Firefox Browser.

I have found one on Jquery site but it require Flash.

I prefer using only javascript if possible.

Thanks

+1  A: 

Sorry, but JavaScript cannot play sound. You'll find it easiest to work with Flash since it's so commonly installed in browsers. JavaScript can interact with SWFs through the ExternalInterface ActionScript API.

Jacob
A: 

You can try something like this:

<script type="text/javascript">
function EvalSound(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.Play();
}
</script>
<embed src="mysound.wav" autostart=false width=0 height=0 id="mysound" enablejavascript="true">

Then, to play on mouseover of a link, add the code:

<a href="#" onMouseOver="EvalSound('mysound')">Move mouse here</A>
sthg
ok I will give a try thanks
lena
Sure, let me know if it works :P
sthg
I was not able to use this script, maybe I just not use it the correct way, I have found other similar scripts with same result.I decide to use Flash finally.
lena
A: 

I was not able to find a way to make it work under Firefox, so I decide to use Flash at the end.

lena