网页点击关闭弹出窗口提示

网页点击关闭弹出窗口提示,点确定关闭,点取消继续留在当前页面

<script>
function h(obj,url){
obj.style.behavior='url(#default#homepage)';
obj.setHomePage(url);
}
if (top.location !== self.location) {
top.location=self.location;
}
//leave.js
var MSG_UNLOAD="您的文章内容还没有进行保存!";
var UnloadConfirm = {};
UnloadConfirm.set = function(confirm_msg){
    window.onbeforeunload = function(event){
        event = event || window.event;
        event.returnValue = confirm_msg;
    }
}
UnloadConfirm.clear = function(){
    window.onbeforeunload = function(){};
}
UnloadConfirm.set(MSG_UNLOAD);
var trim = function(s){;return s.replace(/(^[\s ]*)|([\s ]*$)/g, "");}
function bytes(str){return trim(str).replace(/[^\u0000-\u007f]/g,"\u0061\u0061").length;}
</script>




评论: 1 | 引用: 0 | 查看次数: -
回复回复神经[2008-11-13 12:56 AM | del]
有这么复杂吗?
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.