Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/442.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 播放声音和警觉_Javascript_Jquery_Jquery Plugins - Fatal编程技术网

Javascript 播放声音和警觉

Javascript 播放声音和警觉,javascript,jquery,jquery-plugins,Javascript,Jquery,Jquery Plugins,我想在我的web应用程序中播放一小声嘟嘟声,然后启动一条警报消息 因此,我要: if(_none_valid) { $.playSound('/static/wav/beep_error.wav').delay(300); alert('ERROR: Not found.'); } 发生的情况是,在用户解除警报后播放.wav文件 我已尝试添加延迟(300),如图所示 为什么会这样?应该如何修复 我正在使用它。这是因为您为$添加了300ms的延迟。playSound。您需要为警报

我想在我的web应用程序中播放一小声嘟嘟声,然后启动一条警报消息

因此,我要:

if(_none_valid) {
    $.playSound('/static/wav/beep_error.wav').delay(300);
    alert('ERROR: Not found.');
}
发生的情况是,在用户解除警报后播放.wav文件

我已尝试添加
延迟(300)
,如图所示

为什么会这样?应该如何修复


我正在使用它。

这是因为您为
$添加了
300
ms的延迟。playSound
。您需要为
警报()
添加延迟或

if(_none_valid) {
    $.playSound('/static/wav/beep_error.wav');
    setTimeout(function() {
        alert('ERROR: Not found.');
    }, 300);
}