homepage Welcome to WebmasterWorld Guest from 54.196.197.153
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
resetting a frameset window from a pop-up window it opened
location.href question
Bodge




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

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




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

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




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

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




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

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




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

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

Bodge




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

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




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

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




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


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




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved