Call javascript in parent from child (pop up) window

A

ace danger

I have some javascript that works in Firefox 2 but not in IE 7. In the
parent page, a user clicks a link and a new window is opened so that
they can maintain some values. When the user is finished, they can
click either a save or a cancel button. If the user clicks the save
button, I want the parent page to be refreshed and then the child
window to close. I have this working perfectly in FF2 but it does not
in IE. In IE, the parent page is refreshed but when it refreshes, the
screen that comes back is the same screen as the child window. When
the child window should close, it instead is being refreshed and comes
back as a blank screen.

Does anybody have any ideas as to how I can make this work in IE 7?
From the parent page, here is the hyperlink that opens the popup
window:
<a href="#" onClick="clickAdvEdit('someData');>Advanced Edit...</a>

and funciton clickAdvEdit ultimately does this:
var lUrl = /somepage/index.html
var opt =
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="
+ screen.availWidth + ",height=" + screen.availHeight;
window.open(lUrl ,"", opt, false);
From the save button of the child page:
<button type="button" class="primary"
onClick="showChanges();">Save</button>

and the function showChanges is defined as this:
function showChanges() {
if (typeof window.opener.ctgMaintClick=="function") {
window.opener.ctgMaintClick();
window.close();
}
}

Any ideas or suggestions would be appreciated.

Pete
 
A

ASM

ace danger a écrit :
window:
<a href="#" onClick="clickAdvEdit('someData');>Advanced Edit...</a>

and funciton clickAdvEdit ultimately does this:
var lUrl = /somepage/index.html
var opt =
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="
+ screen.availWidth + ",height=" + screen.availHeight;
window.open(lUrl ,"", opt, false);

truc = window.open(lUrl ,"", opt);
<button type="button" class="primary"
onClick="showChanges();">Save</button>

onclick="opener.ctgMaintClick();">Save< ...
and the function showChanges is defined as this:

and now we only use function ctgMaintClick() declared in file displayed
in mother window (this you call 'parent')

function ctgMaintClick() {
// all expected job except to submit the form
truc.close();
document.theForm.submit();
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top