Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7833707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:51:21+00:00 2026-06-02T12:51:21+00:00

my aim is to put a dropdown list into a cell. var obj =

  • 0

my aim is to put a dropdown list into a cell.

var obj = document.getElementById('dropdown');
var coords = { x: 0, y: 0 };
var element = this;
while (element)
{
 coords.x += element.offsetLeft;
 coords.y += element.offsetTop;
 element = element.offsetParent;
}
obj.style.left = coords.x+'px';
obj.style.top = coords.y+'px';

however, this cant find the accurate position. How to fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T12:51:23+00:00Added an answer on June 2, 2026 at 12:51 pm

    This approach should work perfectly, maybe something else is messing up the positioning?

    If you have an element with style position: relative, elements that are added to that element with style position: absolute with still be relative to that element. If you try to determine the position of an element just by looking at the offset and then walking upwards (disregarding any relatively positioned elements) you wont get the right values. You should find the closest common element with relative positioning and get the offset up to that element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To put this in concise language... Aim: To create a class which can load
My aim is to list all elements of the array a whose values are
I am using this site. Aim : I want to move my footer based
This is going to be fairly hard to explain, so I've put together a
I am trying to put an NSDictionary within an NSArray. My aim is that
how do you covert this html code into the yii CHtml? <form aciton='site/qrcode' method='POST'>
My aim is have the text inside this div displaying in the middle of
my aim is to reverse an array 3,12,2,1 to 1,2,12,3. when i run this
Aim to Achieve : I want the Function to accept List(Of String), Array &
I aim to have a list of lines where I use the word NB

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.