bigoldbird
asked on
Go to anchor in parent frame when iframe contents change
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!
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!
ASKER
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.
ASKER
This is obviously more tricky than I thought!!!
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_pag e" onLoad="goToAnchor(documen t.iframe.d ocument.lo cation);">
************************** **********
I hope this may help!
-Dennis
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_pag
**************************
I hope this may help!
-Dennis
************************** ********** ********** *********
******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
******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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
**************************
<A HREF="url_of_the_other_web
**************************
I hope I could help you!
-Dennis