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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.opener not working

Status
Not open for further replies.

GWINTO

IS-IT--Management
Nov 26, 2001
188
GB
I am trying to reset a select box in a parent window without refreshing the whole page, the child window is used to enter a new value for a drop down box.
The function that should work is:
function refreshlist(passedid)
{
alert(passedid);
var thebox=window.opener.getElementById(passedid);
alert(thebox.id)
thebox.options[thebox.options.length] = new Option('<%=idvalue & &quot;','&quot; & showValue %>');
alert(thebox.options.length)
window.close();
}

The alert boxes are for debugging.

The function is executed using <a href etc> from a child window that is opened from the parent.

The first alert box appears Ok with the correct value, then nothing happens.

Alert(window.opener.value), returns 'unspecified'
Alert(window.opener.location), returns the URL for the child window
Alert(document.parentWindow.location), returns the URL of the parent window

The more you know, the more you realise there is to know....
CCNA MCP
 
Alert(window.opener.location), returns the URL for the child window

Really?? Should be the URL of the page that opened the window...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Sorry got the last 2 the wrong way round should have been:

Alert(window.opener.location), returns the URL of the parent window
Alert (document.parentWindow.location), returns the URL for the child window


The more you know, the more you realise there is to know....
CCNA MCP
 
Did this help?

var thebox=window.opener.document.getElementById(passedid);

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Done this

The alert box opens, but its blank



The more you know, the more you realise there is to know....
CCNA MCP
 
var thebox=eval(&quot;window.opener.document.form.&quot; + passedid);

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top