<script>
function window.onbeforeunload()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
if(confirm("确定要退出本页吗?")); {
location = "";
} else { 关闭窗口
现在的问题是点击"确定"之后,马上关闭窗口了!
}else
{
alert("你在刷新");
//return false;
}
}
</script>
function window.onbeforeunload()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
if(confirm("确定要退出本页吗?")); {
location = "";
} else { 关闭窗口
现在的问题是点击"确定"之后,马上关闭窗口了!
}else
{
alert("你在刷新");
//return false;
}
}
</script>
您说的方法不行,我试过,点击确定后,根本不重定向到我需要的那个页面,而是直接关闭了窗口window.event.returnValue这个值好像是必须的,只有该值为否时,页面才不关闭,而直接定向到另外的一页!
function window.onbeforeunload(){
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey){
if(confirm("确定要退出本页吗?")){
} else {
event.returnValue = false
}
}else{
alert("你在刷新");
}
}
</script>
function window.onbeforeunload(){
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey){
return "强行退出将导致不良后果!"
}
}
</script>