我想在网页中如果在当前页面执行 关闭/最小化/切换页面/移动页面任意一项操作之前要弹出提示框,如果要执行这些操作则当前页面被提交关闭.如果不执行操作则又回到当前页面.
求js实现代码...谢谢了!~
求js实现代码...谢谢了!~
解决方案 »
- javascript 组合问题?
- 如何通过js 获得某个具体地方的天气
- 哪里出错了,且有个地方没理解(attachEvent)
- window.top.document.getElementById("cen").cols IE可以,谷歌浏览器不行
- 初学者的问题:settimeout在IE下不工作,FF下正常?!
- indexedDB的查询问题
- 请问,关于Replace
- 如何判定页面上的某个对象是否存在?采用if(form.select)的形式好像不行,判定语句本身就提示不存在了,那怎么做???
- 怎么样做到关闭a.htm时刷新b.htm呢?
- 求救啊!一个有关的层显示的问题!在线等待.......
- url参数问题
- 怎么把变量名转换成字符串
confirm('真的要删除吗?'){ ……
}
alert("是否要提示!");
</script>
或
<script language="javascript">
confirm("是否要提示!");
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head><body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<meta name="Author" content="Aultoale" />
<style type="text/CSS">
body {font:normal 12px Verdana}
a#tip {position:relative;left:75px; font-weight:bold;}
a#tip:link,a#tip:hover {text-decoration:none;color:#000;display:block}
a#tip span {display:none;text-decoration:none;}
a#tip:visited {color:#000;text-decoration:underline;}
a#tip:hover #tip_info {display:block;border:1px solid #F96;background:#FFEFEF;padding:10px 20px;position:absolute;top:0px;left:90px;color:#009933}
</style>
</head>
<body>
<a id="tip" href="#">
移到这里试试!
<span id="tip_info">这里是提示信息!</span>
</a>
</body>
</html>
</body>
</html>
<body onUnload="alert('关闭');">
但你即使在这里用confirm还是没法阻止关闭
你这种做法太过霸道,我要是用户绝对不肯来你的网站,所以浏览器也没提供这种功能
* Prompt user to confirm the operation when the button is clicked in the current page.
*
* @return true or false
*/
function doContinue() {
return confirm('确认执行此操作吗?!');
//return confirm('<bean:message key="msg.delete.rcd" />');
}function doClose(){
if(doContinue())
{
windows.close();
}
}
JScript codefunction doContinue() {
return confirm('确认执行此操作吗?!');
//return confirm(' <bean:message key="msg.delete.rcd" />');
} function doClose(){
if(doContinue())
{
windows.close();
}
}