window.onbeforeunload = windowClose; function windowClose() { // 表示确认message if(event.clientY < 0) { return "确定关闭?"; } }