Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/369.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
Sweet Alert Javascript插件问题_Javascript_Function_Sweetalert - Fatal编程技术网

Sweet Alert Javascript插件问题

Sweet Alert Javascript插件问题,javascript,function,sweetalert,Javascript,Function,Sweetalert,我在我的网站上使用t插件,在加载页面时显示警告。我用过一次,它就正常工作了 swal({ title: "Security Notice", text: "This site uses cookies to enhance your experience.\nBy continuing to use this site you are agreeing to the use of said cookies.\

我在我的网站上使用t插件,在加载页面时显示警告。我用过一次,它就正常工作了

            swal({
                title: "Security Notice",
                text: "This site uses cookies to enhance your experience.\nBy continuing to use this site you are agreeing to the use of said cookies.\n\nPlease note; Your IP will also be recorded if you make a post.\nThis is for security measures only.",
                allowOutsideClick: "false",
                confirmButtonText: "Accept!"
            },
                function() {
                    $.cookie('allow_cookies', '1', { expires: 160, path: '/' });
                    });
                }
            );
这很有效。但当我添加另一个
swal
函数时,它破坏了它。但第一次警报仍然有效。这是新的代码,引起麻烦的代码

            swal({
                title: "Security Notice",
                text: "This site uses cookies to enhance your experience.\nBy continuing to use this site you are agreeing to the use of said cookies.\n\nPlease note; Your IP will also be recorded if you make a post.\nThis is for security measures only.",
                allowOutsideClick: "false",
                confirmButtonText: "Accept!"
            },
                function() {
                    $.cookie('allow_cookies', '1', { expires: 160, path: '/' });

                    //The following was added, which then caused trouble.

                    swal({
                        title: "Profanity Notice",
                        text: "The guestbook is open to public use,\nAnd so can be subject to obscene language and images.\n\n If you see such text/images, please report it to:\n<a href=\"mailto:abuse@my-coding.com?Subject=MyCoding%20Guestbook%20Abuse\" target=\"_top\">abuse@my-coding.com</a>",
                        allowOutsideClick: "false",
                        html: "true",
                        confirmButtonText: "Accept!"
                    }); //end of the new added code.

                }
            );
swal({
标题:“安全通知”,
text:“本网站使用cookies来增强您的体验。\n继续使用本网站即表示您同意使用所述cookies。\n\n请注意;如果您发表文章,您的IP也将被记录。\n这仅用于安全措施。”,
allowOutsideClick:“false”,
confirmButtonText:“接受!”
},
函数(){
$.cookie('allow_cookies','1',{expires:160,path:'/'});
//添加了以下内容,这导致了麻烦。
游泳({
标题:“亵渎公告”,
text:“留言簿开放供公众使用,\n因此可能会受到淫秽语言和图像的影响。\n\n如果您看到此类文本/图像,请将其报告给:\n”,
allowOutsideClick:“false”,
html:“正确”,
confirmButtonText:“接受!”
});//新添加的代码的结尾。
}
);

我希望这是件愚蠢的事情,比如漏掉分号或括号,但我自己什么也找不到。

到底出了什么问题?控制台中有错误吗?在第一个代码中,它显示了安全通知,这就是它要做的。但在第二个代码中,它显示了安全通知,而不是亵渎通知,它应该这样做。去检查语法。好吧,控制台中有错误吗?好吧,我要尝试的第一件事(不是因为我知道它会工作;这是一个实验)是将第二个
swal()
调用包装在
setTimeout()中
这样警报代码就可以在第一次呼叫完成后清理它需要清理的任何东西。我们正在取得进展。它现在显示亵渎通知,但现在第一个通知没有显示。