SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict jasongr's Avatar
    Join Date
    Jul 2004
    Location
    usa
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to trigger anchor name in the same document

    Hi people

    I have several anchor names listed in my page using:
    <a name="anchor1"></a>
    ....
    <a name="anchor2"></a>

    I want to jump to a certain anchor.
    I would like to trigger the jumping from a JavaScript code. Is that possible?
    I know that if I had a link ending with #anchor1, then clicking on it will take me to the anchor.
    This is not what I want.

    I want to do this in JavaScript. Note that the anchors must be in the same page

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <script>

    window.location="#achor1";

    </script>
    NOTELAY.COM - Have a nice noty day
    ETA CONSULTING

  3. #3
    SitePoint Addict jasongr's Avatar
    Join Date
    Jul 2004
    Location
    usa
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, that was useful


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •