为避免用户误操作退出页面
window.onbeforeunload = function(){
if(document.all){ //ie
//右上角关闭按钮 或 alt+F4 或 ctrl+w
if(event.clientX > document.body.clientWidth || event.clientY < 0 ||event.altKey || event.ctrlKey){
return "关闭窗口";
}else{
return "刷新或跳转";
}
}else{
return "刷新、跳转、关闭";
}
}