Looking for a mouseover sound script
I'm looking for a a mouseover sound script (for button). I plan to use wav sound but it can be another sound format.
Those I have开发者_运维技巧 found on the net are not compatible with new browser version. I especially it need to work in Firefox.
I have found one on Jquery site but it requires Flash.
I prefer using only javascript if possible.
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.
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>
I was not able to find a way to make it work under Firefox, so I decide to use Flash at the end.
精彩评论