Was*_*ikh 26 javascript browser jquery yui page-refresh
在__CODE__页面上,当用户点击/按下__CODE__按钮页面刷新但在刷新之前我想执行一个功能或一个简单的警报.
用户可以点击刷新按钮,按__CODE__或__CODE__.
使用核心__CODE__,__CODE__或__CODE__.
ban*_*ang 40
window.onbeforeunload = function(event)
{
return confirm("Confirm refresh");
};
Run Code Online (Sandbox Code Playgroud)
$(window).bind('beforeunload', function(){
return '>>>>>Before You Go<<<<<<<< \n Your custom message go here';
});
Run Code Online (Sandbox Code Playgroud)
资料来源:http://www.mkyong.com/jquery/how-to-stop-a-page-from-exit-or-unload-with-jquery/
演示:http://www.mkyong.com/wp-content/uploads/jQuery/jQuery-stop-page-from-exit.html
| 归档时间: |
|
| 查看次数: |
41733 次 |
| 最近记录: |