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

Getting URL from another frame?

Status
Not open for further replies.

DVDGirl

Programmer
Mar 29, 2001
42
US
Hi -
I have page with a header frame and a main frame. In the header frame is a link called, "Remember this Spot". Basically, when the link is clicked, it is supposed to run code that will update a database with the main frame's URL. (So when the user comes back to the site, they can click on another link which will access the database, then redirects the browser to that "remembered" page.)

I know how to do the updating database part in ASP. However, I don't know how to get the main frame's URL, and I'm having trouble getting the onClick to run the ASP code.

I've been reading that the latter may not be possible. Can anyone give me advice on how to tackle this problem? Thank you in advance!

-DVD Girl
 
to get the main frame url from the header frame, using javascript, if your Mainframe is the second frame in the frameset ie
<frameset>
<frame src=&quot;HeaderFrame.asp&quot; ...>
<frame src=&quot;MainFrame.asp&quot; ...>
</frameset>
:

<script languagejavascript>
var MainURL = parent.frames[1].document.location.href
</script>

or if you have a name property in the main frame tag ie <frame name=&quot;MainFrameName&quot; ...> :

<script languagejavascript>
var MainURL = parent.MainFrameName.document.location.href
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top