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

Getting the href from one frame and viewing it in another

Status
Not open for further replies.

T1M

Programmer
Jul 3, 2001
14
CA
I have a page with two frames. The top one has a button that when pressed, I want it to get the url of the bottom frame. The problem is that I want to use the bottom frame to navigate to other sites and domains.

Frameset:
<frameset rows=&quot;20%,*&quot;>
<frame name=&quot;topbar&quot; src=&quot;top.cfm&quot; marginwidth=&quot;1&quot; marginheight=&quot;1&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; noresize>
<frame name=&quot;bottombar&quot; src=&quot;bottom.cfm&quot; marginwidth=&quot;1&quot; marginheight=&quot;1&quot; scrolling=&quot;auto&quot; frameborder=&quot;0&quot;>
</frameset>

The top frame:
<script language=&quot;JavaScript&quot;>
function getURL(){
document.formgo.thisurl.value = top.frames.bottombar.location.href;
}
</script>
<input type=&quot;button&quot; value=&quot;Get URL&quot; onClick=&quot;getURL();&quot;>
<input type=&quot;text&quot; size=&quot;40&quot; name=&quot;thisurl&quot; value=&quot;&quot; maxlength=&quot;255&quot;>

The bottom frame could have a location of anywhere. The above script works when the location of the bottom frame has the same domain as the domain of frameset.

I am willing to try anything so even if your idea is a bit off the wall, go for it.

Thanks,

T1m
 
I was wondering if you had your form(<form>)tag with a name &quot;formgo&quot; if not, try it.
 
Yeah, my form name is &quot;formgo&quot;.

Tim
 
Tim, you can't get url of frame, wich document is from another domain..
but if you set this url handy, why not save it in some hidden field & then check it instead of checking directly location property of that frame
(but it won't work if user/you would click on some link on that page & thy change url..:-( ) Victor
 
Thanks Victor. It's too bad it won't work.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top