loading a url from nested frames popup

I'm posting for a friend... I want to load a url from a popup into another frame.
The initial frameset is split the screen vertically into 3rds. Frames named Left, Middle & Right. The left fame is split in 1/2. The frame names are LeftUpper & LeftLower.The LeftLower frame is the frame I want to launch the popup from. The Middle frame named Middle is not split at all. The Right frame named Right contains a file which loads a new frameset and is split horizontally by  3rds. Named (top to bottom) A,B & C. I want to load frame C with a new URL from the popup. I'm using NN4 but would like a solution to work in IE4 also if possible. I have tried things like opener.frames[2].frames[2].location.href = URL but that doesn't work:( I have also tried opener.frames['LeftUpper'].frames['C'].location.href = URL!!! Nothing seems to work. One final note I need it in location.href=URL format ! I have posted an example of the frame layout  at www.capoeirasj.com/example/setup.html
sargentoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sargentoAuthor Commented:
Edited text of question
0
sargentoAuthor Commented:
Edited text of question
0
sargentoAuthor Commented:
I put up an additional graphic to help clarify at:
www.capoeirasj.com/example/setup2.html
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Trevor013097Commented:
sargento,

Referencing Frames from popup windows is always a tricky one and often needs a lot of thought as to layout.  However, that said I have solved your problem.

What you have to do is give your orginal window (the one which contains all the frames) a name when you open the popup.  To open the popup use this script in your LowerLeft frame:-

<SCRIPT LANGUAGE="JavaScript">
<!--

var newWindow;
winOpts='menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,width=250,height=250';

      self.name = 'opener';
      Urlvar = "popup.html";
      popup = window.open(Urlvar,'newWindow',winOpts);

// --->
</SCRIPT>

Notice the use of self.name = 'opener'; this can be named anything you choose but opener seems logical.  Of course you can turn on or off any of the options and change the window dimensions.

The popup is then launched and in your popup you should have something like this:

<HTML>
<HEAD>
<TITLE>PopUp</Title>
</HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--

function GoThere() {
   opener.top.Right.C.location.href = "popup.html";
}

// --->
</SCRIPT>

<BODY BGCOLOR=cream><center>
Popup
<BR>

<A HREF="javascript:GoThere();">Link to Frame C</A>
</body>
</html>


Notice here the call to the function which then loads the correct page in the frame 'C' by firsat referencing the opener then the top of that then the Right frame and finally the frame 'C'.

Hope this helps.

Trevor.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Trevor013097Commented:
sargento,

You can of course set up all of your frames using only one frameset.  This would then make things easier when referencing frames as you would only have one level.

Your frameset could then look like this:-

<FRAMESET FRAMEBORDER="no" BORDER=0 COLS="40%,20%,40%">
   <FRAMESET FRAMEBORDER="no" BORDER=0 ROWS="50%,50%">
     <FRAME SRC="LeftUpper.html" NAME="LeftUpper" noresize marginheight=0 marginwidth=0 SCROLLING=AUTO>
     <FRAME SRC="LeftLower.html" NAME="LeftLower" noresize marginheight=0 marginwidth=0 SCROLLING=AUTO>
   </FRAMESET>
   <FRAME SRC="DefaultMiddle.html" NAME="Middle" noresize marginheight=0 marginwidth=0 SCROLLING=AUTO>
   <FRAMESET FRAMEBORDER="no" BORDER=0 ROWS="33%,33%,33%">
     <FRAME SRC="defaultA.html" NAME="A" noresize marginheight=0 marginwidth=0 SCROLLING=AUTO>
     <FRAME SRC="DefaultB.html" NAME="B" noresize marginheight=0 marginwidth=0 SCROLLING=AUTO>
     <FRAME SRC="DefaultC.html" NAME="C" noresize marginheight=0 marginwidth=0 SCROLLING=AUTO>
   </FRAMESET>
</FRAMESET>

You then do not need the 2 pages you currently have called DefaultRight.html and Defaultleft.html which set up your previous framesets.

If you choose this approach you will then need to reference Frame 'C' from the popup using this:

<HTML>
<HEAD>
<TITLE>PopUp</Title>
</HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--

function GoThere() {
   opener.top.C.location.href = "popup.html";
}

// --->
</SCRIPT>

<BODY BGCOLOR=cream><center>
Popup
<BR>

<A HREF="javascript:GoThere();">Link to Frame C</A>
</body>
</html>


It is exactly the same as before except that the line:

   opener.top.Right.C.location.href = "popup.html";

has changed to:

   opener.top.C.location.href = "popup.html";

Hope this helps.

Trevor.


0
sargentoAuthor Commented:
Trevor I have to digest your answer. I can't use one frameset because different URLs will be loaded in the Right  frame.
0
Trevor013097Commented:
sargento,

Just thought I'd offer the single framset solution aswell to make my answer complete.

If you have any problems then let me know.

Trevor.

0
sargentoAuthor Commented:
Hi Trevor,
I confused about what you did.
First of all I have all my stuff setup. As far as the popup goes, I just can't get the popup to load the C frame. I guess I should have mentioned that.
Question 1.
You said this function should be in my popup window:


 function GoThere() {
    opener.top.Right.C.location.href = "popup.html";
 }

but what is the popup.html file mentioned? Did you mean the URL to be loaded in frame C?

the second question is:

self.name = 'opener';
 popup = window.open(Urlvar,'newWindow',winOpts);

so in the frame that launches the popup (in this case LeftLower) I should have these lines?
does the self.name name the top frameset even though it is in the LeftLower frame? Also what's the purpose of assigning the whole string to popup?

Thanks:)
0
Trevor013097Commented:
sargento,

The popup.html in the function is as you correctly stated the name of the file you wish to load in Frame 'C', sorry I named it popup.html, some bizarre logic on my part.

In your frame (Lowerleft) where you launch the popup from you name it using self.name which does name that particular frame and not the top frameset.  This however does not matter (it is the easiest way to do it), it simply gives you a reference in the original window otherwise you have nothing by which to refer to this window.  Once you have given one of the frames a name you can navigate through them as we are doing.

This line:

popup = window.open(Urlvar,'newWindow',winOpts);

simply opens the window.  As you have already got your code to open the window you can probably ignore it, I didn't realise you already had a window open.  All I have done is plit out the various parts of the window opening.

What I have done is defined some variables:

winOpts='menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,width=250,height=250';

self.name = 'opener';
Urlvar = "popup.html";

Which set the options for the window and the URL to load in it and name my current frame.


popup = window.open(Urlvar,'newWindow',winOpts);

This then simply says:

Open the new window.  Load the variable we defined as URLvar, set the windows name as newWindow and then set all the windows options which we have already defined as winOpts.

The popup we have assigned this all to is a variable of the object that opened the newWindow. newWindow is the new window's name.  The new window's properties can be referenced through the varoibale popup. Links and forms can be targeted to the new window with its name newWindow.

I hope that helps a bit.  Windows are always difficult things to get to grips with I find.

Trevor.

0
sargentoAuthor Commented:
FYI opener.top.Right.C.location.href worked. I couldn't use the self name=opener because I was reloading other frames and I was getting the no properties error. It still worked with out naming the frame opener??? It is difficult to explain what I'm doing but it is working now! Thanks
0
Trevor013097Commented:
I got into the habit of naming the opener with the name 'opener' to try and make referencing work across more browsers.  Most times the opener will be referrable to as opener but on some older browsers the reference opener was not valid and hence you had to actually name it opener. (Hope you managed to follow that!!)

Glad it all worked anyway ;-)

Trevor.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.