Open Bug 387456 Opened 17 years ago Updated 2 years ago

a question about get element's offsetLeft in Javascript

Categories

(Core :: DOM: Core & HTML, defect, P5)

1.8 Branch
x86
Windows XP
defect

Tracking

()

UNCONFIRMED

People

(Reporter: lczheng, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1) Gecko/20061010 Firefox/2.0

I have a question about get element's offsetLeft in Javascript.

My code like here:

var offsetLeft = el.offsetLeft;
while( el=el.offsetParent ){
offsetLeft += el.offsetLeft;
}

Those codes work correctly in IE, but it is not correct in FireFox. I searched about this question in Google, I think this is maybe a bug in firefox, isn't it? Can you help me how to get a element's offsetLeft in FireFox? I will appreciate your help in advance.

Thank you very much!


Sincerely

Jim Zheng

my email: lczheng@gmail.com

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Actual Results:  
alway return offsetLeft=0

Expected Results:  
actual element's offsetLeft
What do you mean by "doesn't work correctly"? Can you attach a minimized testcase showing exactly what the problem is?
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.8 Branch
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.