如何在关闭showModalDialog时刷新父窗口(点showModalDialog右上角的那个关闭图标)

如何在关闭showModalDialog时刷新父窗口(点showModalDialog右上角的那个关闭图标)

[code="js"]

window.onbeforeunload = function() { var n = window.event.screenX - window.screenLeft; var b = n > document.documentElement.scrollWidth-20; if(b && window.event.clientY < 0 || window.event.altKey){ alert("这是一个关闭操作而非刷新"); window.event.returnValue = ""; //此处放你想要操作的代码 opener.location.reload(); }else{ alert("这是一个刷新操作而非关闭"); } }

[/code]

大致思路就是这样 应该没问题的 不懂的站内联系我。