why are you suggesting top and left with auto? I have never used auto so I'm not sure what it does here.
Main Topics
Browse All TopicsI have got a an autocomplete box that I cannot seem to position properly. I have tried several different methods to position it, but everything ends up way off. Here is the code that I am using to position it. Please help!!!
function DisplayTable(divName, textBoxName) {
document.getElementById(di
document.getElementById(di
document.getElementById(di
document.getElementById(di
document.getElementById(di
}
function curTop(obj){
toreturn = 0;
while(obj){
toreturn += obj.offsetTop;
obj = obj.offsetParent;
}
return toreturn;
}
function curLeft(obj){
toreturn = 0;
while(obj){
toreturn += obj.offsetLeft;
obj = obj.offsetParent;
}
return toreturn;
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Ok, setting the parent container to relative positioning, and trying to position from there got it working. I did have to do some tweaking to my javascript as the auto didn't work. I will award points, and also post the updated positioning code.
function DisplayTable(divName, textBoxName) {
document.getElementById(di
document.getElementById(di
document.getElementById(di
document.getElementById(di
document.getElementById(di
}
function curTop(obj){
toreturn = 0;
toreturn += obj.offsetTop;
obj = obj.offsetParent;
toreturn += obj.offsetTop;
return toreturn;
}
function curLeft(obj){
toreturn = 0;
toreturn += obj.offsetLeft;
obj = obj.offsetParent;
toreturn += obj.offsetLeft;
return toreturn;
}
auto basically positions using the relative position as if it were hardcoded in the HTML. By making it position: absolute, the div should float above the container but be relatively positioned still. But as is always true with any positioning whether you use CSS or JS, it's always a bit of trial and error to jiggle the divs into their proper positions!
Anyway, glad you cracked it with a hybrid JS and CSS! :)
Business Accounts
Answer for Membership
by: MrHorizontalPosted on 2006-08-18 at 08:49:18ID: 17343336
Don't bother using offsetTop and doing stuff via DHTML, do it via CSS.
Make the <div> have a CSS class something like this:
.divName
{
position: absolute;
top: auto;
left: auto;
}
But if you do this, you will need to have the div that holds this div with position: relative; so the absolute div will reference to that div's position.