感知刷新頁面是否有未提交的數據

<script language="javascript" type="text/javascript">javascript


var unloadConfirm={};java


unloadConfirm.MSG = "有數據還未保存!!!";spa


unloadConfirm.set = function(a) {ip


 window.onbeforeunload = function(b) {it


 if($(".not_submit").size()){//自定義的class,標記未提交的數量io

    b = b||window.event;event


    b.returnValue = a;function


    return aclass

 }數據


}


};


unloadConfirm.clear = function() { 


 window.onbeforeunload = function(){}


};


//alert($(".not_submit").size());

unloadConfirm.set(unloadConfirm.MSG);


</script>

相關文章
相關標籤/搜索