?
Solved

Go to anchor in parent frame when iframe contents change

Posted on 2003-02-21
6
Medium Priority
?
488 Views
Last Modified: 2010-05-18
Sorry, this should be a simple one but I have brain fog.

I have an iframe which contains a list (which may be long) and links to a specification page from that list. (I have no coding access to these pages)

When someone moves from the list to the specification page I just want to move to a named anchor at the top of the parent page (otherwise the middle of the page may be displayed and the user will have to scroll to see top of the specification) .... sounds easy!
0
Comment
Question by:bigoldbird
6 Comments
 
LVL 2

Expert Comment

by:DennisParaguay
ID: 7995106
Make your links look like this:

************************************
<A HREF="url_of_the_other_website" onClick="parent.location.href = 'url_of_the_parent_website#name_of_the_anchor';">Linktext</A>
************************************


I hope I could help you!

-Dennis
0
 

Author Comment

by:bigoldbird
ID: 7999259
I wish it were that easy Dennis ... I have no coding access at all to the page in the iframe, so can't do anything with the links.
0
 

Author Comment

by:bigoldbird
ID: 8029222
This is obviously more tricky than I thought!!!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:DennisParaguay
ID: 8029493
Hi Big Old Bird!

Put this in the header of your parent page:

************************************
<script>
function goToAnchor(site)
{
     var anchor;
     if (site == 'url_of_the_1st_site') anchor = 'name_of_the_1st_anchor';
     if (site == 'url_of_the_2nd_site') anchor = 'name_of_the_2nd_anchor';
     self.location.href = ('#' + anchor);
}
</script>
************************************

and make your IFRAME tag look like this:

************************************
<iframe name="iframe" src="url_of_the_iframe_page" onLoad="goToAnchor(document.iframe.document.location);">
************************************


I hope this may help!

-Dennis
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10082997
*******************************************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
*******************************************************
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area:
RECOMMENDATION:

 - [PAQ No Refund]

Please leave any comments here within the next seven days.
*******************************************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
*******************************************************

jAy
EE Cleanup Volunteer
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 10133022
PAQed - no points refunded (of 200)

SpazMODic
EE Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question