How to find the position of a link

Discussion in 'Javascript' started by Chris Leonard, Aug 31, 2003.

  1. Hi.

    I have a number of links on my page. When I click on one of them I am
    scrolling in a picture from the lefthand side. I have got this to work
    nicely now following some suggestions made last week but with one problem
    still remaining.

    When I click the link the browser jumps to the top of the page and scrolls
    my picture in from there. The reason is this is what I'm telling it to do by
    setting the top property. How can I find the top property of the link I
    clicked on so I can set it correctly ?

    Here is a copy of the link

    <A href="#" onClick="layername=makeName('<%Response.Write("picture" &
    rcd)%>'); yhop=0; ygoal=10; xhop=40; xgoal=100; slide();">Click me</A>

    I've tried:

    <A id='<%Response.Write("link" & rcd)%>' href="#"
    onClick="layername=makeName('<%Response.Write("picture" & rcd)%>'); yhop=0;
    ygoal=10; xhop=40; xgoal=100; slide();">Click me</A>

    and checked for the link(x).style.top but this doesn't work!!

    Any help would be appreciated.

    TIA.

    Chris
     
    Chris Leonard, Aug 31, 2003
    #1
    1. Advertisements

  2. Chris Leonard

    VK Guest

    Anchor "#" referencing the top of the current document.
    Use "javascript:void(0)" instead to nullify the link:

    <a href="javascript:void(0)" onClick="...">


    Chris Leonard <> wrote in message
    news:bisgac$8hh$...
    > Hi.
    >
    > I have a number of links on my page. When I click on one of them I am
    > scrolling in a picture from the lefthand side. I have got this to work
    > nicely now following some suggestions made last week but with one problem
    > still remaining.
    >
    > When I click the link the browser jumps to the top of the page and scrolls
    > my picture in from there. The reason is this is what I'm telling it to do

    by
    > setting the top property. How can I find the top property of the link I
    > clicked on so I can set it correctly ?
    >
    > Here is a copy of the link
    >
    > <A href="#" onClick="layername=makeName('<%Response.Write("picture" &
    > rcd)%>'); yhop=0; ygoal=10; xhop=40; xgoal=100; slide();">Click me</A>
    >
    > I've tried:
    >
    > <A id='<%Response.Write("link" & rcd)%>' href="#"
    > onClick="layername=makeName('<%Response.Write("picture" & rcd)%>');

    yhop=0;
    > ygoal=10; xhop=40; xgoal=100; slide();">Click me</A>
    >
    > and checked for the link(x).style.top but this doesn't work!!
    >
    > Any help would be appreciated.
    >
    > TIA.
    >
    > Chris
    >
    >
     
    VK, Aug 31, 2003
    #2
    1. Advertisements

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. Luqman
    Replies:
    1
    Views:
    834
    Luqman
    Feb 7, 2006
  2. James Wong
    Replies:
    4
    Views:
    776
    James Wong
    Jul 14, 2004
  3. Wybo Dekker
    Replies:
    1
    Views:
    631
    Yukihiro Matsumoto
    Nov 15, 2005
  4. vdvorkin
    Replies:
    0
    Views:
    623
    vdvorkin
    Feb 10, 2011
  5. vdvorkin
    Replies:
    3
    Views:
    1,092
    vdvorkin
    Feb 14, 2011
  6. Replies:
    3
    Views:
    309
  7. James Black
    Replies:
    0
    Views:
    554
    James Black
    May 28, 2006
  8. brendan
    Replies:
    0
    Views:
    314
    brendan
    Aug 29, 2006
Loading...