Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / August 2005

Tip: Looking for answers? Try searching our database.

Element positioning thrown off by body margin

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad Wood - 26 Aug 2005 21:16 GMT
If I try to position an element even with the top of another one, it
ends up higher than I want it due to the default height of the body
margin.

So the top of a div element that I want to place my dynamic element on
top of gives an offsetTop of 0, but if I place my element at 0 it shows
on the very top of the page - higher than the static element due to the
margin.

What should I do differently?
Brad Wood - 31 Aug 2005 15:23 GMT
Sorry, it seems my javascript to determine position was incorrect.
FWIW, the code to get position is simply:
function findPosY(obj)
{
  var curtop = 0;
  while (obj)
  {
    curtop += obj.offsetTop
    obj = obj.offsetParent;
  }
  return curtop;
}

> If I try to position an element even with the top of another one, it
> ends up higher than I want it due to the default height of the body margin.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.