问题
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
Bellow is the 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.
回答1:
You can pass arguments to showModalDialog function. Simply pass window object as an argument.
window.showModalDialog(theURL, window);
Yo can access the arguments from the modal window using dialogArguments. See: http://msdn.microsoft.com/en-us/library/ms533723%28VS.85%29.aspx
var openerWindow = window.dialogArguments;
回答2:
Can you try the below function if it works The window.close will close the window
function submitValues(value1,value2)
{
window.opener.document.getElementById("value1Id").value = value1;
window.opener.document.getElementById("value2Id").value = value2;
window.close();
}
来源:https://stackoverflow.com/questions/12142392/window-opener-not-working-in-chrome-ie