点击esc按钮甜蜜警报不应该关闭

时间:2016-05-12 13:33:55

标签: javascript php

当用户点击esc警报时,不应该关闭他应该点击立即付款按钮进一步移动。

 if($unpaid==true){
     echo $print = '<script>
      function alertOn(){
swal({ 
        title: "No Membership Fees Received",
        text: "Please pay membership fees as per your selected package",
        type: "warning",
        confirmButtonText: "PAY NOW"

      },
      function(){
        window.location.href = "unpaid.php";
    });
};
window.onload = alertOn
</script>';

3 个答案:

答案 0 :(得分:1)

if ($unpaid == true) {
    echo $print1 = '<script>
    function alertOn(){
        swal({ 
            title: "No Membership Fees Received",
            text: "Please pay membership fees as per your selected package",
            type: "warning",
            confirmButtonText: "PAY NOW",
            **allowEscapeKey:false**

          },
          function(){
            window.location.href = "unpaid.php";
        });
    };
    window.onload = alertOn;
</script>';
}

答案 1 :(得分:0)

我认为您可以使用此版本:

swal({
  title: 'title',
  text: 'your text',
  button: false,
  closeOnClickOutside: false,
  closeOnEsc: false
});

答案 2 :(得分:-1)

是的,您可以通过将swalallowEscapeKey属性修改为allowOutsideClick来配置false函数,例如:

swal({
       title: 'title',
       text: 'your text',
       showConfirmButton: true,
       allowEscapeKey : false,
       allowOutsideClick: false
    });