單擊浏覽器右上角的X彈出提示窗口,簡單實現。
復制代碼 代碼如下:
<script language="javascript">
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>