offset not working as desired in FireFox

Discussion in 'Javascript' started by Pavan, May 23, 2006.

  1. Pavan

    Pavan Guest

    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
     
    Pavan, May 23, 2006
    #1
    1. Advertising

  2. Pavan

    Matt Kruse Guest

    Pavan wrote:
    > 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 :)

    --
    Matt Kruse
    http://www.JavascriptToolbox.com
    http://www.AjaxToolbox.com
     
    Matt Kruse, May 23, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lance Riedel

    Translated Offset to Source Offset

    Lance Riedel, Oct 14, 2003, in forum: XML
    Replies:
    2
    Views:
    526
    Patrick TJ McPhee
    Oct 15, 2003
  2. Replies:
    0
    Views:
    488
  3. Deryck
    Replies:
    7
    Views:
    105
  4. Roy Smith
    Replies:
    4
    Views:
    319
    Roy Smith
    Jan 27, 2013
  5. Magnus Warker

    BCS - time offset not working!

    Magnus Warker, Jun 19, 2013, in forum: Java
    Replies:
    3
    Views:
    220
    Magnus Warker
    Jun 20, 2013
Loading...

Share This Page