Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange proble with window.opener

Status
Not open for further replies.

rturner003

Programmer
Nov 20, 2001
21
GB
I have two applications, although it shouldn't matter one is sourced from perl and the other from asp, and they both carry out the same function but with different results. The function is that from a JavaScript routine a pop up window is called where a user selects from a list and then presses a continue button. A JavaScript routine in the pop up window then takes data from the selected item and puts that into input boxes on the main form.

To to this is use the opener.document.form.control=value.

On one this works and the other the JavaScript just stops. After a bit of playing around I discover it was a problem with the opener object. I therefore tried the following bit of code immediately the continue was pressed: alert(window.opener.name). Again the asp sourced system returned a value the other just stopped working with no alert box returned at all.

Has anybody any idea why this happening. I mean this is all client side JavaScript running on exactly the same browser!

cheers
Robert T Turner
 
Hi,
Normally, It dosen't work if you directly use
window.opener.document.frmName.element.value="some vlue".
parentWindow=window.opener;
parentWindow.LINK_DTL.frmLINK_DTL.txtContract_No.value =temp
parentWindow is my calling window
LINK_DTL is my frame Name and its case sensetive
frmLINK_DTL this is my form name no need to mention document
txtContract_No.value this is a control and assigining a value to it..
if you try this it should work.
if you give me code, i may able to test at my end.
reg
suds... suds,
Nucleus Software Exports Ltd
csroy@yahoo.com
sudhakar.roy@nucleussoftware.com
 
Hey rturner003,

Maybe your opener-object isn't valid (this happens sometimes).
You could try this piece of code:

newWindow = window.open(url, name, options);
newWindow.opener = window;

This will assign the opening window to the opener-property of the new window. This way you will be sure that window.opener has a value.

Greetzzz...

Raver1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top