请点击下面的关闭按钮时使用此脚本执行弹出窗口,但我想添加一个额外的脚本,以帮助我在" OK&#时打开新的URL /页面34;点击按钮请任何人帮助我,这是使用的JavaScript:
<script language="Javascript">
var needToConfirm = true;
window.onbeforeunload = confirmExit;
function confirmExit(){
if (needToConfirm){
my_window = window.open ("1.html","mywindow1","status=1,width=350,height=150");
return "You have attempted to leave this page. If you have made any changes "
+"to the fields without clicking the Save button, your changes will be "
+"lost. Are you sure you want to exit this page?";
}
}
</script>
答案 0 :(得分:1)
我想添加一个额外的脚本,以便在单击“确定”按钮时帮助我打开新的URL /页面
根据定义,这是不可能的。如果用户确认他们想要离开页面,则该页面无法再执行任何操作。这是一项安全功能,可以防止被关闭的网站通过新窗口向用户发送垃圾邮件。
答案 1 :(得分:-1)
看起来您希望父(开启者)窗口重新加载/加载页面? 这是一个如何执行此操作的示例: http://www.plus2net.com/javascript_tutorial/window-refreshing.php