offset not working as desired in FireFox

P

Pavan

Hi,

I have developed script library for dispalying calendar for my web
pages.

To display calendar, i am using div tag and with in div tag, i am
defining the dates.

This div tag is wrapped by IFrame control, in order to make the div tag
overlap over 'select' controls.

These controls (both Div and IFrame) are dynamically generated and i am
setting the width of div tag based on my text box associated with the
calendar.

IFrame width is determined by Div tag's offsetWidth.

This calculation works properly in IE 6.0, but when it comes to Firefox
1.5.0, the offsetWidth has been calculated wrongly and my calendar
shrinks abnormally.

Can some body help me

Regards,

Pavan
 
M

Matt Kruse

Pavan said:
This div tag is wrapped by IFrame control, in order to make the div
tag overlap over 'select' controls.

Not necessary. Instead, place an iframe _under_ the div. It works better.
IFrame width is determined by Div tag's offsetWidth.
This calculation works properly in IE 6.0, but when it comes to
Firefox
1.5.0, the offsetWidth has been calculated wrongly and my calendar
shrinks abnormally.

You are possibly seeing differences in box models.
Firefox uses the W3C "standard" box model.
IE uses this when in strict mode (by using an appropriate DOCTYPE),
otherwise it uses its own box model (which happens to make much more sense
than the W3C box model, but it's too late now...)
See http://www.quirksmode.org/css/quirksmode.html for info.

Offsetwidth should behave the same in both browsers, since it was invented
by MS and FF and other browsers simply copy the behavior. It should measure
from outside to outside, including borders and padding. So, the specifics of
your case depend on your exact html.

When asking for assistance on a specific problem, it is always best to show
the actual problem. Provide an example url. Or if that's not possible, at
least post problematic code here. Always minimize to the smallest possible
test case which still exhibits the problem - remove everything that isn't
necessary. The exercise of created a minimal test case is often enough to
make you realize what the root problem is and solve it yourself before
needing to ask :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,058
Members
48,769
Latest member
Clifft

Latest Threads

Top