我在我的网站上使用Sweet Aler 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.
}
);
我希望它有些愚蠢,比如错过了分号或括号,但我自己找不到任何东西。