[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 296
  • Last Modified:

object position

Hi,

on my html document i have for example image that is positioned absolutly.
How can I later on read properties of that object (left,top,height).

hpet
0
hpet
Asked:
hpet
  • 3
  • 2
1 Solution
 
FRehmanCommented:
you can use alert that display the property
alert(document.form1.objectname.left)
0
 
hpetAuthor Commented:
FRehman,

this only returns object properties if it is positioned "relativly". If object is positioned "absolutly" it always returns 0,0. I read something that offset* functions should be used for absolutly positioned objects, but I can't make it work.

hpet
0
 
hpetAuthor Commented:
ok, i found the right way.
for absolutly positined objects you use offset* properties. my problem was bad control naming (two with same name).
offset* properties return position in parent..

hpet
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
HolySpiritCommented:
hpet,

How about alert(document.form1.objectname.offsetLeft)?

<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>
Ha, ha, it works on my computer, how about yours ?

========================================
P.S. The other offset* are :

offsetHeight
offsetParent
offsetTop
offsetWidth
offsetX
offsetY

-- Holy Spirit
0
 
hpetAuthor Commented:
right :)

thanks
0
 
HolySpiritCommented:
hpet,
Thanks for your marks ...
-- Holy Spirit
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now