思路很简单啊,加个标志就行 HTML code
<!--只是思路,没测试-->
<head>
<title> </title>
<script language='javascript'>
var sflag=true;
function dealwith()
{
location.href="123.aspx?type='gy';"
} function LeaveWin()
{ if(sflag) alert('leave');
}
</script>
</head>
<body onbeforeunload="LeaveWin()">
<input type="button" id="B1" onclick="sflag=false;dealwith();">
<!--只是思路,没测试-->
<head>
<title> </title>
<script language='javascript'>
var sflag=true;
function dealwith()
{
location.href="123.aspx?type='gy';"
} function LeaveWin()
{ if(sflag) alert('leave');
}
</script>
</head>
<body onbeforeunload="LeaveWin()">
<input type="button" id="B1" onclick="sflag=false;dealwith();">
3楼朋友<input type="button" id="B1" onclick="sflag=false;dealwith();">
这是自定义的按纽,当然你可以设定onclick事件浏览器的按纽能捕获它的click事件么??????