[英]how alert message to client when the page want refresh?
Hi to all I'm beginner in java script I need to make some alert and shown that when the page want refresh and done some work like counter=0 or delete a file how can I do this by jquery and java script?
大家好,我是Java脚本的初学者,我需要发出一些警报,并表明当页面需要刷新并完成一些工作(如counter = 0)或删除文件时,如何通过jquery和Java脚本执行此操作? thank!
谢谢!
Before page load/refresh: 在页面加载/刷新之前:
<head>
alert("hello");
</head>
Within body: 体内:
<script>
$count= 0;
while ($count < 10 ) {
$count++;
}
alert("counter increased: " + $count + " times");
</script>
You can bind refresh event: 您可以绑定刷新事件:
window.onbeforeunload = function () {
return 'Post job process not completed yet.';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.