js在离开页面时弹出提示

有时候在编辑页面用户做修改后,可能会有刷新、关闭等误操作造成当前页面信息的丢失,何不先提醒一下用户呢?实例代码如下:

 

window.onbeforeunload = function(event){
            event = event || window.event;
            event.returnValue = ' ';
    }

posted @ 2010-08-16 10:18  ido  阅读(2230)  评论(0)    收藏  举报