Hi, Thank you for your reply. I have written code to find the location of the div:
 function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }
Basically it keeps adding all the left offsets for the parent nodes until i reach the top. Is this alright? Once i get that I can only approsimately get the right position. Say the node is 'p tag'. Then it could have lots of text which will eventually resize. So i can get my arrow somewhere in 'p tag' for sure. But what about the location in that. If you resize this browser window, you will see that the text above that i have written will readjust too. However the smallest dom node returned will be 'p tag' for the above text. I can get using dom the location of p tag but how can i maintin the position of the arrow within that 'p tag' tag so that it points to the same word? or will it always be approximate? Also, if I have a node which I have got using event object, can I store it in some form (like offset from root etc...) so that I can retrieve it at a later stage (e.g. when I revisit the page, I will use perl to place the arrow over there but for that i need to know the node which I had clicked earlier). Is there anyway to store the node information so that I can retrieve it later? Thank you for your time and effort. Anant

In reply to Re^7: Position on Web Page by user2000
in thread Position on Web Page by user2000

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.