如题!
直接贴代码了:
<!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>
<title></title>
<script type="text/javascript">
window.onbeforeunload = function ()
{
return "您确定要关闭添加文章页面吗?";
}
function showMessage(event)
{
alert('Hello World');
//event.cancelBubble = true;
//if (event.stopPropagation) event.stopPropagation();
return false;
}
</script>
</head>
<body>
<a href="javascript:void(0);" onclick="return showMessage(event);">点击看看</a>
</body>
</html>
运行截图:
关闭浏览器时:
点击链接后:
谢谢浏览!