gpt4 book ai didi

javascript - 如何在 FireFox 中关闭 showModalDialog,在 javascript 中关闭 Chrome

转载 作者:行者123 更新时间:2023-11-30 05:52:41 25 4
gpt4 key购买 nike

var userChoice = showModalDialog("../Iframe.aspx?FormName=sample.aspx", window,     "dialogTop:300px;dialogLeft:350px;dialogHeight:182px;dialogWidth:370px;help:no;scroll:no;status:no;");        
alert(userChoice); /* here iam not able to get 'Y' */
if (userChoice == 'Y')
return true; else return false;

Below is the Sample aspx page:

input type="button" value="Yes" onclick="choice('Y')"

function userChoice(option)
{
window.returnValue = option;
alert(window.returnValue); /* here iam getting 'Y' */
parent.close(); // I have tried with self.close() also
}

最佳答案

您不能从模态对话框中关闭 parent.window。使用 window.close()top.close() 关闭模式。

Chrome 中的 returnValue 有一个错误,似乎还没有修复,请试试这些:

showModalDialaog not returning value in Chrome

chromium/issues/detail?id=42939

关于javascript - 如何在 FireFox 中关闭 showModalDialog,在 javascript 中关闭 Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13738964/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com