我正在寻找鼠标悬停声音脚本(用于按钮)。我打算使用 wav 声音,但它可以是另一种声音格式。
我在网上找到的那些与新的浏览器版本不兼容。我特别需要在 Firefox 中工作。
我在 Jquery 网站上找到了一个,但它需要 Flash。
如果可能的话,我更喜欢只使用 javascript。
我正在寻找鼠标悬停声音脚本(用于按钮)。我打算使用 wav 声音,但它可以是另一种声音格式。
我在网上找到的那些与新的浏览器版本不兼容。我特别需要在 Firefox 中工作。
我在 Jquery 网站上找到了一个,但它需要 Flash。
如果可能的话,我更喜欢只使用 javascript。
抱歉,JavaScript 无法播放声音。您会发现使用 Flash 最容易,因为它通常安装在浏览器中。JavaScript 可以通过ExternalInterface
ActionScript API 与 SWF 交互。
你可以尝试这样的事情:
<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">
然后,要在鼠标悬停链接时播放,添加代码:
<a href="#" onMouseOver="EvalSound('mysound')">Move mouse here</A>
我无法找到让它在 Firefox 下工作的方法,所以最后我决定使用 Flash。