?
Solved

Go to anchor in parent frame when iframe contents change

Posted on 2003-02-21
6
Medium Priority
?
485 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

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!

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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

777 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