简体   繁体   English

window.opener在chrome和IE中不起作用

[英]window.opener not working in chrome & IE

I have one child popup. 我有一个孩子弹出窗口。 From this child popup I am sending some values from child popup to textbox of parent page. 从此子弹出窗口中,我将一些值从子弹出窗口发送到父页面的文本框。

javascript is working fine in firefox but not working in chrome & IE javascript在Firefox中工作正常,但在chrome和IE中不工作

Bellow is the javascript 波纹管是JavaScript

function submitValues(value1,value2)
{
  window.close();
  window.opener.document.getElementById("value1Id").value = value1;
  window.opener.document.getElementById("value2Id").value = value2;
}

I am not able to figure out that what is the problem. 我不知道这是什么问题。

You can pass arguments to showModalDialog function. 您可以将参数传递给showModalDialog函数。 Simply pass window object as an argument. 只需将window对象作为参数传递。

window.showModalDialog(theURL, window);

Yo can access the arguments from the modal window using dialogArguments. 您可以使用dialogArguments从模态窗口访问参数。 See: http://msdn.microsoft.com/en-us/library/ms533723%28VS.85%29.aspx 请参阅: http//msdn.microsoft.com/en-us/library/ms533723%28VS.85%29.aspx

var openerWindow = window.dialogArguments;

Can you try the below function if it works The window.close will close the window 如果可以,您可以尝试以下功能吗window.close将关闭窗口

function submitValues(value1,value2)
{

   window.opener.document.getElementById("value1Id").value = value1;
   window.opener.document.getElementById("value2Id").value = value2;
   window.close();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM