Navigation Problem

Discussion in 'Javascript' started by Rose Girl, May 12, 2004.

  1. Rose Girl

    Rose Girl Guest

    Hi,

    This may be a simple problem, but i need some help on this.

    When i load a new page, i want it to automatically navigate to a specific
    position in the page. (like a hyperlink to a heading in the page)

    How can i do this.

    Thanks for your help
    Rose Girl
     
    Rose Girl, May 12, 2004
    #1
    1. Advertising

  2. Rose Girl

    pcx99 Guest

    Rose Girl wrote:

    > Hi,
    >
    > This may be a simple problem, but i need some help on this.
    >
    > When i load a new page, i want it to automatically navigate to a specific
    > position in the page. (like a hyperlink to a heading in the page)
    >
    > How can i do this.
    >
    > Thanks for your help
    > Rose Girl



    window.scrollto(x,y);

    window.scrollto(0,0) will scroll to the top.

    window.scrollto(0,1000) will scroll 1,000 pixels down.

    To scroll to a specific element you'll need to calculate the position of
    that element. There's a prettygood script here:
    http://www.quirksmode.org/js/findpos.html

    A much SIMPLER way to do this is to simply use the <A NAME="marker"></A>
    tag and then at the bottom of your document put...

    window.location.href="pagename.html#marker" where pagename.html is the
    name of your page and #marker is the name of your name tag.

    Good luck!

    -------------
    http://www.hunlock.com -- DHTML for the rest of us.
     
    pcx99, May 12, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simone

    Smart Navigation Problem

    Simone, Jun 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    404
  2. Jason Rodman
    Replies:
    0
    Views:
    407
    Jason Rodman
    Jul 23, 2003
  3. Ross Carter

    Simple navigation problem

    Ross Carter, Nov 27, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    365
    Ross Carter
    Nov 28, 2003
  4. Ying Huang-Isella

    Smart Navigation problem with Javascript

    Ying Huang-Isella, Feb 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    718
    Peter Blum
    Feb 21, 2004
  5. Laurahn
    Replies:
    3
    Views:
    914
    Steven Cheng[MSFT]
    Feb 6, 2007
Loading...

Share This Page