在声音结束前使用EvalSound重播声音

时间:2012-01-26 20:43:37

标签: javascript

我有这段代码:

<script>
function EvalSound(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.Play();
}
</script>

<embed src="success.wav" autostart=false width=1 height=1 id="sound1"
enablejavascript="true">

我在使用此javascript代码触发函数时播放此声音。我的代码如下所示:

-function code-
pA = false;
EvalSound('sound1');
} else {
-more code-

这一切都有效,但如果在播放声音之前再次触发,则无效。我希望它能够在再次触发该功能时立即重放声音,即使声音尚未结束。

尝试EvalSoundOff,但没有运气

希望这是可能的,欢迎所有建议,谢谢!!

1 个答案:

答案 0 :(得分:1)

thissound.Rewind();之上添加thissound.Play();为我工作!

相关问题