弹出框sweetalert插件的简单使用

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>sweetalert</title>
    
    <link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/sweetalert/1.1.2/sweetalert.min.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/sweetalert/1.1.2/sweetalert.min.js"></script>
    
</head>
<body>
    <!-- 参考sweetalet中文版文档:http://mishengqiang.com/sweetalert/ -->
    <!-- 还有一个bootstrap风格的sweetalert插件 地址:http://lipis.github.io/bootstrap-sweetalert/-->
    <script type="text/javascript">

        swal({
            title: "你确定?",
            text: "您将无法恢复这个文件!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "是的,删除!",
            cancelButtonText: "不,取消",
            closeOnConfirm: false,
            closeOnCancel: false
        }, function(isConfirm) {
            if (isConfirm) {
                swal("删除!", "您的文件已被删除!", "success")                       
            } else{
                swal("取消!", "您的文件是安全的!", "error")
            }
        })
    </script>
</body>
</html>
原文地址:https://www.cnblogs.com/reblue520/p/8484314.html