sweetalert : 一个比较好看的弹出框

1.引入

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"> </script> 

2.三个常用的提示框

$(".demo_1").click(function() { 
    swal("这是一个信息提示框!"); 
}); 
$(".demo_2").click(function() { 
    swal("Good!", "弹出了一个操作成功的提示框", "success"); 
}); 
$(".demo_3").click(function() { 
    swal("OMG!", "弹出了一个错误提示框", "error"); 
});

3.警告框提示

swal({ 
    title: "您确定要删除吗?", 
    text: "您确定要删除这条数据?", 
    type: "warning", 
    showCancelButton: true, 
    closeOnConfirm: false, 
    confirmButtonText: "是的,我要删除", 
    confirmButtonColor: "#ec6c62" 
}, function() { 
    $.post(getUrl("Cart/del"), {id: id}, function(data) { 
        location.reload(); 
    }) 
});

 

 

原文地址:https://www.cnblogs.com/donghb/p/7543345.html