当前位置:编程学习 > 网站相关 >>

关闭浏览器 弹窗口

var leaveFlag = 0;//value 0 is leave page show warn alert

function returnValue(){
if (leaveFlag == 0) {
var after_i = $("#invitees").val();
if (before_i != after_i) {
return "您的信息尚未保存.";
} else {
window.onbeforeunload = null;
}
}
};

//for browsers bind event
function leavePageVerify() {
if (window.addEventListener) { // all browsers except IE before version 9
window.addEventListener("beforeunload", OnBeforeUnLoad, false);
} else {
if (window.attachEvent) { // IE before version 9
window.attachEvent("onbeforeunload", OnBeforeUnLoad);
}
}
}
//chrome,ie9
function OnBeforeUnLoad() {
return returnValue();
}

//ff,ie8.ie7
window.onbeforeunload = function() {
return returnValue();

};

//upload

leavePageVerify();

 


 

补充:综合编程 , 其他综合 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,