On this page ...
Control another page to goto the
TOP anchor
When using frames, it can be usefull,
to enable a button that sends the other frame to the TOP anchor
you have defined (see Named Anchors).
Usually this button is an <A
HREF="top"> on the same page but that's
not the case here.
The other frame is NOT the same page,
so how do we do that then ?
Once more: welcome to JAVASCRIPT.
This code enables this feature.
|
 |
How is it done?
Say we have two frames "main"
and "text".
The button resides on the "main"
frame, but we want to send the "text" frame to it's "top";
<script>
function goto_top()
{
textpage=parent.frames["text"].location.href;
if (textpage.indexOf('#')>-1)
{
targetlink=textpage.slice(0,textpage.indexOf('#')),'text';
}
else
{
targetlink=textpage+'#top','text';
}
window.open(targetlink,'text');
}
</script>
Now make a button, on the page that will
be placed in the "main" frame, with
<A HREF="javascript:goto_top();">Jump</A>
|