|
|
|
在用户离开页面时提示信息 |
|
|
| http://www.iyit.net 日期:2005-7-18 8:28:35 来源:易特网络技术 点击: |
有时候在编辑页面用户做修改后,可能会有刷新、关闭等误操作造成当前页面信息的丢失, 何不先提醒一下用户呢?实例代码如下:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <title>confirm before leave</title> <script language="javascript" type="text/javascript">
<!-- var pb_strconfirmclosemessage; var pb_blnclosewindow = false; pb_strconfirmclosemessage ="您真的要离开本页吗?"; function confirmclose() { window.event.returnvalue = pb_strconfirmclosemessage; pb_blnclosewindow = true; } function showconfirmclose(blnvalue) { if(blnvalue) { document.body.onbeforeunload = confirmclose; } else { document.body.onbeforeunload = null; } } //--></script> </head> <body onload="showconfirmclose(true);"> <input type=button value="提示" onclick="showconfirmclose(true);"> <input type=button value="不提示" onclick="showconfirmclose(false);"> <input type=button value="测试刷新" onclick="window.location.reload();"> </body> </html>
|
上一篇:asp + oracle 分页方法(不用存储过程)
下一篇:绑定txt文件到datagrid
[发送给好友] [打印本页] [关闭窗口] [返回顶部] 转载请注明来源:http://www.iyit.net |
|
| 特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。 |
| 责任编辑: 黑鹰 |
投稿作者: 易特网络 |
| 信息来源: 易特网络技术 |
录入时间: 2005-7-18 8:28:35 |
| 浏览次数: |
投稿信箱: shtghy@163.com |
|
|
|
|
|