SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    0 Post(s)
    0 Thread(s)

    Question getting position of an element... stumped

    I'm puzzled by how this works (or doesn't so far...)

    I'm playing with Kevin Yank's code for a popup menu. What I need is to make the popup relative to the position of the menu button, which is in a centered table.

    So, I was thinking if I can read the position of the menu button on the page, then I can set the popup menu to the proper location. The problem is that I can't seem to get that position.

    In the course of testing, I tried this code to set and then read the position of one of the popup menus: = 680;

    This works fine, it sets the left position of the menu, and can read the position back to me as a test.

    But when I try just reading the menu position without previously setting it, as in:


    it comes back with a null string. However the menu exists and has a left position... I can see it pop up!

    Why is this happening?


  2. #2
    SitePoint Evangelist azizur_rahman's Avatar
    Join Date
    Nov 2001
    London, UK
    0 Post(s)
    0 Thread(s) = 680;

    is different from

    The = 680; sets the value and next one reads it.... its easy as saying store x=680 next saying tell me what is the value of x.

    but alert(; you are trying to read the value is not reference to a complete DOM or does not exist within the DOM. if you look at you code for menu4 does is have thefollowing attrivutes set? name=menu4 or id=menu4 ?

    have you tried:

    some of this may not work on Netscape or other browsers...
    Azizur Rahman
    Web Application Developer


Posting Permissions

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