Welcome to WeetHet!


Managed Web Hosting by Liquid Web

Your IP address:
44.210.99.209
     
 
Print this page
- use Landscape
Search the
WeetHet Pages
WeetHet is being updated! - Current articles will slowly move to www.tweaking4all.com
For excellent webhosting that is reliable and affordable, we highly recommend: LiquidWeb

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.

HTML

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>


 

 


Klik hier om te wisselen naar nederlandstalige pagina's You are currently on the English pages.