且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Javascript中的确认框

更新时间:2022-12-02 18:28:32



您可以返回false,然后它将仅停留在当前页面上.其他方面,您可以发出警报以检查其是否进入其他部分
像这样

Hi,

You can return false then it will stays on current page only. other wise in else part you can put alert to check its coming to else part or not
like this

function confirmation() {
    var answer = confirm(window.close());
    if (answer){
        alert("Bye bye!")
        window.location = "http://www.yahoo.com/";
    }
    else{
        alert("Thanks for sticking around!")
    }
}