用户离开页面进行提示
koo · 2005-08-26
网页特效与免费的东东
介绍网页特效的,顺便介绍点实惠免费的东西。希望大家多多关注,谢谢。
Updated
返回
Blog 首页
<< 免费发短信(一)不用注册,支持移动联通!
|
用户离开页面进行提示
Time:
2005-08-26
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<!-- Search Google -->
<center>
<form method="get" action="
http://www.google.com/custom
" target="_top">
<table bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<a href="
http://www.google.com/
">
<img src="
http://www.google.com/logos/Logo_25wht.gif
" border="0" alt="Google" align="middle" width="75" height="32"></a>
<input type="text" name="q" size="31" maxlength="255" value="">
<input type="submit" name="sa" value="搜索">
<input type="hidden" name="client" value="pub-2424037443464579">
<input type="hidden" name="forid" value="1">
<input type="hidden" name="ie" value="GB2312">
<input type="hidden" name="oe" value="GB2312">
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1;">
<input type="hidden" name="hl" value="zh-CN">
</td></tr></table>
</form>
</center>
<!-- Search Google -->
<p>有时候在编辑页面用户做修改后,可能会有刷新、关闭等误操作造成当前页面信息的丢失,何不先提醒一下用户呢?实例代码如下:</p>
<p class="code"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN"><br>
<html><br>
<head><br>
<title>Confirm Before Leave</title><br>
<script language="javascript" type="text/javascript"><br>
<br>
<!--<br>
var pb_strConfirmCloseMessage;<br>
var pb_blnCloseWindow = false;<br>
pb_strConfirmCloseMessage ="您真的要离开本页吗?";<br>
function ConfirmClose() {<br>
window.event.returnValue = pb_strConfirmCloseMessage;<br>
pb_blnCloseWindow = true;<br>
}<br>
function ShowConfirmClose(blnValue) {<br>
if(blnValue) {<br>
document.body.onbeforeunload = ConfirmClose;<br>
} else {<br>
document.body.onbeforeunload = null;<br>
}<br>
}<br>
//--></script><br>
</head><br>
<body onload="ShowConfirmClose(true);"><br>
<input type=button value="提示" onclick="ShowConfirmClose(true);"><br>
<input type=button value="不提示" onclick="ShowConfirmClose(false);"><br>
<input type=button value="测试刷新" onclick="window.location.reload();"><br>
</body><br>
</html></p>
</body>
</html>
ko
Posted at
2005-08-26
14:38:26
Edit
|
Trackback(
0
)
原始快照:web.archive.org