469,609 Members | 1,146 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Call javascript in parent from child (pop up) window

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,menub ar=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

Jan 12 '07 #1
1 11221
ASM
ace danger a écrit :
>
>>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,menub ar=0,scrollbars=1,resizable=1,width="
+ screen.availWidth + ",height=" + screen.availHeight;
window.open(lUrl ,"", opt, false);
truc = window.open(lUrl ,"", opt);
>>From the save button of the child page:
<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();
}
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 12 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Tomas Vera | last post: by
1 post views Thread by Jason Huang | last post: by
2 posts views Thread by Jason Wilson | last post: by
11 posts views Thread by manstey | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.