87,997
社区成员




function test(){
window.open('about:blank');
window.onunload = function close() {
if (document.body.clientWidth - event.clientX < 170 && event.clientY < 0 || event.altKey) {
alert("要关闭了!"); }
};
}
function test(){
window.open('about:blank');
window.onunload = function close() {
if (document.body.clientWidth - event.clientX < 170 && event.clientY < 0 || event.altKey) {
alert("要关闭了!");
}
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript">
function test(){
var w = window.open('about:blank');
w.document.open();
w.document.write("<html><body><script type='text\/javascript'>window.onbeforeunload=function(){alert('close');};<\/script></body></html>");
w.document.close();
}
test();
</script>
</head>
<body>
</body>
</html>