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

frames a popup and the frusterated coder

Status
Not open for further replies.

corpsinhere

Technical User
Feb 15, 2000
23
US
I am using a popup to give visitors the option of leaving a frame. The popup is called by the same link(using OnClick)that loads the frame with a new URL (so the link that called the popup is now gone). Here is what I do not understand: after the new URL has loaded, I can no longer get access to the frame. The two frames in the frameset are named "A" and "B". opener.top.location.href gives the frameset URL. Opener.top.A.location.href gives the URL of the "A" frame. Opener.top.B.location.href (the frame which once contained the link which opened the popup but now contains a new URL) gives me nothing nada zip. No error message, just blank whitespace. There are many practical solutions to my fame-breaking problem, but I really want to know WHY I cannot access the URL of this frame after it has a new URL loaded. (By the way...if I activate the function BEFORE the new URL is loaded I CAN get the URL of the original page to print!). I hope this was somewhat coherant. Thanks.
 
I don't understand what you mean by Opener.top.B.location gives you nothing... can you post your URL? I think I can help then :eek:) thanks.. <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
the URL : <A HREF=" TARGET="_new"> the top left &quot;BUY BUTTON&quot; and then click &quot;YES&quot; to the popup &quot;Do you want to leave the leatherhyman frame?&quot;<br>The navigation frame on the left is frame &quot;A.&quot; The main frame on the right is frame &quot;B.&quot; The right &quot;BUY BUTTON&quot; works as it should; I was screwing with the left one to try to figure out this javascript nuance.<br>Thanks.<br>PS remember to let the new URL load before you click &quot;YES&quot;<br>
 
to refer to a frame by name, use &quot;top.frames.A&quot; instead of &quot;top.A&quot;. That should do it... if not, let me know :eek:) <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
I'm sorry, that was incomplete... I didn't look over everything, and actually, I think there's a much easier way to do it. Try it like this:<br><br>function leave (wantsTo) {<br>&nbsp;&nbsp;if (wantsTo) window.opener.top.location.href = window.opener.top.frames.B.location;<br>&nbsp;&nbsp;close();<br>}<br><br>......<br><br>&lt;H4 ALIGN=&quot;center&quot;&gt;&lt;FONT COLOR=&quot;#00FF00&quot;&gt;Want to leave the Leather Hyman frame?&lt;/FONT&gt;<br>&lt;FORM OnSubmit=&quot;return false;&quot;&gt;<br>&lt;INPUT TYPE=&quot;submit&quot; VALUE=&quot;Yes&quot; OnClick=&quot;leave(true);&quot;&gt;<br>&lt;INPUT TYPE=&quot;submit&quot; VALUE=&quot;No&quot; OnClick=&quot;leave(false);&quot;&gt;<br>&lt;/FORM&gt;<br>&lt;/H4&gt;<br><br>.......<br><br>I'm not sure about the DOM references- I think those are accurate, I'm not 100% sure.<br><br><FONT FACE=monospace>wantsTo</font> is a boolean variable telling the function whether or not it should leave the main window. The popup should leave in any case, so you only need to write one function. Try that and see how it works. Again, I'm not 100% sure, so check back :eek:) either by post or by email... doesn't matter. I'll probably end up posting to the forum, though, just so anybody else who happens to be interested can take a look. <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top