代码如下: window.onunload = function () { if (event.clientY < 0 && event.clientX> document.body.scrollWidth) { //event.returnValue = 'Are you sure you want to leave the page? '; window.alert('欢迎光临爱智旮旯的博客!') } } script>