Welcome to WebmasterWorld Guest from 54.226.62.251

Forum Moderators: open

Message Too Old, No Replies

resetting a frameset window from a pop-up window it opened

location.href question

     

Bodge

11:20 pm on May 16, 2003 (gmt 0)

10+ Year Member



OK, here is my dilemma. I have a frameset with 2 frames, nav and main. At one point, I open up another site with frames inside of main. That new site opens a popup (which I control) and I need to send the link from that popup to my initial frameset (to main specifically). I've tried everything I can think of, but I admittedly don't know JavaScript that well. Here are a couple of the things I have tried:

<a href="javascript;" onClick="
document.main.location.href= 'http://www.url.com';
self.close();
return false;
">Click here</a>

<a href="javascript;" onClick="
window.main.location.href= 'http://www.url.com';
self.close();
return false;
">Click here</a>

<a href="javascript;" onClick="
opener.location.href= 'http://www.url.com';
self.close();
return false;
">Click here</a>

That last one is the closest, but I know it just send you back to the original frame that opened it up. Any help would be greatly appreciated.

Willie Bodger

tedster

12:56 am on May 17, 2003 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome to WebmasterWorld, Bodge.

window.opener certainly must be part of the picture here. It's the only way to address the original window from a new window.

I'm not clear about what you want to have happen that your third script isn't doing. It should set the frame you've called "main" to the page url.com - or whatever URL you put in there.

Bodge

4:12 am on May 17, 2003 (gmt 0)

10+ Year Member



OK, here's the full deal. The popup is opened from a nested frame, let's call it frame5. That frame is within a frameset that is inside another frame, frame2.
Frameset1
Frame1 (left)
Frame2 (body)
Frameset2
Frame3 (left)
Frame4 (top)
Frame5 (body) This frame opens the popup, but I want the link to target the whole of frame2. Right now it just opens in frame4 so it keeps they left and top frames from frameset2, which I don't want. Does it make better sense now? I want to basically replace frameset2 (yes, the entire frameset, I already have the info I need from that frameset and have no further need for it) with another page for frame2 (within frameset1).

TIA
Willie Bodger

Bodge

5:45 pm on May 21, 2003 (gmt 0)

10+ Year Member



OK, does anybody have any input on this topic for me? The basic need I have is to target an existing frame other than the one that opened it from a popup. So, frame C opens a popup window that has a URL that I want to target frame B. Any thoughts...?

WB

tedster

5:50 pm on May 21, 2003 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Have you tried resetting parent.opener.location.href?

Bodge

6:10 pm on May 21, 2003 (gmt 0)

10+ Year Member



I should have prefaced by saying I don't know javascript that well, more of a VBScript/SQL guy... So, when you say reset parent.opener.location.href, do you really mean redefine what that points to? If so, I don't know how to do that. I have tried using parent.opener.location.href, I've tried top.parent.opener.location.href, I've tried top.opener.location.href etc. all to no avail.

WB

Bodge

6:18 pm on May 21, 2003 (gmt 0)

10+ Year Member



So, I ended up going away from using location.href and just using a straight href with a target command and then sticking on onClick within the A tag to close the popup which seems to work just fine. Though I would still like to know how to use the location.href to target a different frame...

WB

BlobFisk

11:49 am on May 22, 2003 (gmt 0)

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member




Though I would still like to know how to use the location.href to target a different frame...

location.href is a javascript command that tells a document to change it's current location URL to whatever you specify.

You can target any frame, by working from the top down (from the outermost frameset) to the fame you wish to address. For example, window.frameName.location.href will change the address of the frame called frameName.

parent refers to the parent frameset of the current frame, whereas using window goes to the very top and works it's way down.

HTH

Bodge

12:21 am on May 23, 2003 (gmt 0)

10+ Year Member



Which is what I thought, but it didn't work...
I used the following:
window.main.location.href
where the name of the frame I want to target is 'main' and it is within the top level frameset, so it should be window.main.location.href, right? Now, the popup originates from a frameset within the frame 'main', but Window should take me back up to the top, right?

WB

 

Featured Threads

Hot Threads This Week

Hot Threads This Month