Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/460.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript-从弹出窗口将父级重定向到新页面_Javascript_Parent Child_Window.open - Fatal编程技术网

Javascript-从弹出窗口将父级重定向到新页面

Javascript-从弹出窗口将父级重定向到新页面,javascript,parent-child,window.open,Javascript,Parent Child,Window.open,我有一个页面,可以使用Javascript打开一个弹出的文件选择器窗口。用户选择文件后,父窗口将重定向到加载文档的页面。我已经准备好了很多有同样问题的帖子,但还没有找到解决办法。我有以下代码: 母公司 openChildWindow("FileMan2.aspx?UN=<%= Header1.UserNumber %>&FormMode=OPEN&RetObj=PRINTLETTER&PrintCase=" + OpenFlag, 550, 350); fu

我有一个页面,可以使用Javascript打开一个弹出的文件选择器窗口。用户选择文件后,父窗口将重定向到加载文档的页面。我已经准备好了很多有同样问题的帖子,但还没有找到解决办法。我有以下代码:

母公司

openChildWindow("FileMan2.aspx?UN=<%= Header1.UserNumber %>&FormMode=OPEN&RetObj=PRINTLETTER&PrintCase=" + OpenFlag, 550, 350);

function openChildWindow(URL, width, height) {
        if (window.showModalDialog) {
            window.showModalDialog(URL, window.self, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;center:yes;scroll:no;resizable:no;status:no;unadorned:no;edge:raised");
        } else {
            window.open(URL, "docman", "width=" + width + ", height=" + height + ", screenX=0, screenY=0, status=no, scrollbars=no,toolbar=no,menubar=no,top=200,left=200,modal=yes");
        }
    }
openChildWindow(“FileMan2.aspx?UN=&FormMode=OPEN&RetObj=PRINTLETTER&PrintCase=“+OpenFlag,550350”);
函数openChildWindow(URL、宽度、高度){
if(window.showModalDialog){
showmodaldiallog(URL,window.self,“dialogWidth:+width+”px;dialogHeight:+height+”px;中间:是;滚动:否;可调整大小:否;状态:否;未修饰:否;边缘:凸起);
}否则{
打开(URL,“docman”,“width=“+width+”,height=“+height+”,screenX=0,screenY=0,status=no,scrollbars=no,toolbar=no,menubar=no,top=200,left=200,model=yes);
}
}
孩子

var URL=window.location.protocol+“/”+window.location.host+“/CaseLetter.aspx?Case=&UN=&Letter=“+file+”&FileName=“+file+”&COID=&FilePath=”;
window.opener.location.href=URL;
URL的计算结果为“”


我得到的错误是“无法获取未定义或空引用的属性‘location’。我在这里做错了什么?

我会将对模态的引用存储在一个变量中,然后使用其
closed
布尔属性轮询以查看模态何时关闭,如下所示(这在运行下面的代码段时不起作用,因为stackoverflow会阻止modals,但您可以将其复制到chrome开发工具控制台中进行验证)

let modal=window.open(“https://www.google.com?q=cats“,”文档管理员“,”宽度=500,高度=500,屏幕X=0,屏幕Y=0,状态=no,滚动条=no,工具栏=no,菜单栏=no,顶部=200,左侧=200,模态=yes”)
函数onClose(){
警报(“模态已关闭”)
}
让intervalID=setInterval(()=>{
if(模态和模态关闭){
clearTimeout(有效期间)
onClose()
}

},200)
窗口。opener
不适用于
窗口。showModalDialog
 var URL = window.location.protocol + "//" + window.location.host + "/CaseLetter.aspx?Case=<%= CaseNumber %>&UN=<%= Header1.UserNumber %>&Letter=" + file + "&FileName=" + file + "&COID=<%=GlobalVar.LawFirm %>&FilePath=<%= AddPath %>";
        window.opener.location.href = URL;