Firefox offsetLeft problem

Discussion in 'ASP .Net' started by Gary Coutts, Mar 22, 2006.

  1. Gary Coutts

    Gary Coutts Guest

    Hi,

    I am developing a website using Visual Studio .Net 2003.

    When reading offsetLeft, in a javascript function, the result is fine when
    run under I.E. but gives wrong results when run under Firefox. The HTML and
    java are shown below:

    /-------------------------------HTML-------------------------------------------------------/

    <table width="800" id="shopPanel" align="center" height=780 border=1
    bordercolor=#000000>
    <tr>
    <td>
    <label>test</label>
    </td>
    </tr>
    </table>



    /---------------------------------Java---------------------------------------------------------/
    var Panel ;
    function GetPosition()
    {
    var Left ;
    var ParentLeft ;

    Panel = document.getElementById("shopPanel") ;

    Left = Panel.offsetLeft ;
    ParentLeft = Panel.offsetParent.offsetLeft ;
    }


    The Java function results give the following:


    IE Left - 132 Parent Left - 0
    Firefox Left - 8 Parent Left - 0



    Does anyone have any suggestions as to the cause of the above problem?

    Cheers

    Gary Coutts
    Gary Coutts, Mar 22, 2006
    #1
    1. Advertising

  2. Gary Coutts

    Bruce Barker Guest

    firefox uses the w3c (html 4.0) standard for measurements, IE uses its own
    propriety measurements. you can direct IE to try to be html 4.0 compatible
    (but only the mac version is complete).

    see:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie60/html/cssenhancements.asp

    for hints on getting better results from IE.

    -- bruce (sqlwork.com)

    "Gary Coutts" <> wrote in message
    news:%...
    > Hi,
    >
    > I am developing a website using Visual Studio .Net 2003.
    >
    > When reading offsetLeft, in a javascript function, the result is fine when
    > run under I.E. but gives wrong results when run under Firefox. The HTML
    > and java are shown below:
    >
    > /-------------------------------HTML-------------------------------------------------------/
    >
    > <table width="800" id="shopPanel" align="center" height=780 border=1
    > bordercolor=#000000>
    > <tr>
    > <td>
    > <label>test</label>
    > </td>
    > </tr>
    > </table>
    >
    >
    >
    > /---------------------------------Java---------------------------------------------------------/
    > var Panel ;
    > function GetPosition()
    > {
    > var Left ;
    > var ParentLeft ;
    >
    > Panel = document.getElementById("shopPanel") ;
    >
    > Left = Panel.offsetLeft ;
    > ParentLeft = Panel.offsetParent.offsetLeft ;
    > }
    >
    >
    > The Java function results give the following:
    >
    >
    > IE Left - 132 Parent Left - 0
    > Firefox Left - 8 Parent Left - 0
    >
    >
    >
    > Does anyone have any suggestions as to the cause of the above problem?
    >
    > Cheers
    >
    > Gary Coutts
    >
    Bruce Barker, Mar 23, 2006
    #2
    1. Advertising

  3. Gary Coutts

    Gary Coutts Guest

    Thanks for the reply. It's a good article.


    Cheers

    Gary

    "Bruce Barker" <> wrote in message
    news:...
    > firefox uses the w3c (html 4.0) standard for measurements, IE uses its own
    > propriety measurements. you can direct IE to try to be html 4.0 compatible
    > (but only the mac version is complete).
    >
    > see:
    >
    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie60/html/cssenhancements.asp
    >
    > for hints on getting better results from IE.
    >
    > -- bruce (sqlwork.com)
    >
    > "Gary Coutts" <> wrote in message
    > news:%...
    >> Hi,
    >>
    >> I am developing a website using Visual Studio .Net 2003.
    >>
    >> When reading offsetLeft, in a javascript function, the result is fine
    >> when run under I.E. but gives wrong results when run under Firefox. The
    >> HTML and java are shown below:
    >>
    >> /-------------------------------HTML-------------------------------------------------------/
    >>
    >> <table width="800" id="shopPanel" align="center" height=780 border=1
    >> bordercolor=#000000>
    >> <tr>
    >> <td>
    >> <label>test</label>
    >> </td>
    >> </tr>
    >> </table>
    >>
    >>
    >>
    >> /---------------------------------Java---------------------------------------------------------/
    >> var Panel ;
    >> function GetPosition()
    >> {
    >> var Left ;
    >> var ParentLeft ;
    >>
    >> Panel = document.getElementById("shopPanel") ;
    >>
    >> Left = Panel.offsetLeft ;
    >> ParentLeft = Panel.offsetParent.offsetLeft ;
    >> }
    >>
    >>
    >> The Java function results give the following:
    >>
    >>
    >> IE Left - 132 Parent Left - 0
    >> Firefox Left - 8 Parent Left - 0
    >>
    >>
    >>
    >> Does anyone have any suggestions as to the cause of the above problem?
    >>
    >> Cheers
    >>
    >> Gary Coutts
    >>

    >
    >
    Gary Coutts, Mar 24, 2006
    #3
    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. Pieter Van Waeyenberge

    offsetLeft & Top differ for different element types?

    Pieter Van Waeyenberge, Feb 15, 2004, in forum: Javascript
    Replies:
    0
    Views:
    111
    Pieter Van Waeyenberge
    Feb 15, 2004
  2. Pieter Van Waeyenberge
    Replies:
    2
    Views:
    142
    Pieter Van Waeyenberge
    Feb 16, 2004
  3. Keith Thornhill

    offsetLeft/Top Bug in Firefox? (value is 8)

    Keith Thornhill, Aug 15, 2004, in forum: Javascript
    Replies:
    4
    Views:
    267
    Grant Wagner
    Aug 16, 2004
  4. Replies:
    3
    Views:
    215
    Fred Oz
    Jan 13, 2005
  5. Paul Nash

    Firefox offsetLeft

    Paul Nash, Jun 9, 2006, in forum: Javascript
    Replies:
    1
    Views:
    115
    Robert
    Jun 9, 2006
Loading...

Share This Page