PDA

View Full Version : window.opener()


WillowFae
04-16-2003, 10:06 AM
I have opened a new window (called "details") which amongst other things has a button on it. When the button is clicked I want the window that opened "details" to be reloaded with a new page and "details" to be closed.

Now I understand you can use window.opener() to refer to this main window but the code I've written doesn't seem to work. lt loads the new page fine, but does it in the "details" window.

Here is the function

function gotoEdit(id)
{
window.opener(location.href="admin.cfm?id=" + id + "&method=edit");
window.close();
}

Where am I going wrong?

Weirdan
04-16-2003, 10:20 AM
opener is a property, not a method

function gotoEdit(id)
{
window.opener.location.href="admin.cfm?id=" + id + "&method=edit";
window.close();
}

WillowFae
04-16-2003, 10:22 AM
Ah, excellent, thanks :) All my book said was that you could use window.opener but didn't give the syntax.

Weirdan
04-16-2003, 10:25 AM
MSDN Library (http://msdn.microsoft.com/) is better then your books :)

WillowFae
04-16-2003, 10:26 AM
Hmm, I've always found that very hard to navigate and actually find what I want.

brothercake
04-17-2003, 01:32 AM
Originally posted by WillowFae
Hmm, I've always found that very hard to navigate and actually find what I want.
me too ... damn frame-jumping thing .. does my head in ... a good tip is not to use its search function - use Google:

site:msdn.microsoft.com your search words

Much better :)

I'd personally recommend the JS documentation at devedge - http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/ - it will give you the standards, where MSDN is very IE-centric.