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. Advertising

  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. 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. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    852
    Kevin Spencer
    May 17, 2005
  2. Luqman
    Replies:
    1
    Views:
    657
    Luqman
    Feb 7, 2006
  3. Wybo Dekker
    Replies:
    1
    Views:
    362
    Yukihiro Matsumoto
    Nov 15, 2005
  4. vdvorkin
    Replies:
    0
    Views:
    411
    vdvorkin
    Feb 10, 2011
  5. vdvorkin
    Replies:
    3
    Views:
    813
    vdvorkin
    Feb 14, 2011
Loading...

Share This Page