468,741 Members | 1,884 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,741 developers. It's quick & easy.

Firefox offsetLeft problem

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
Mar 22 '06 #1
2 1950
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/de...hancements.asp

for hints on getting better results from IE.

-- bruce (sqlwork.com)

"Gary Coutts" <Ga********@algorel.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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

Mar 23 '06 #2
Thanks for the reply. It's a good article.
Cheers

Gary

"Bruce Barker" <br******************@safeco.com> wrote in message
news:Oq**************@tk2msftngp13.phx.gbl...
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/de...hancements.asp

for hints on getting better results from IE.

-- bruce (sqlwork.com)

"Gary Coutts" <Ga********@algorel.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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


Mar 24 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Keith Thornhill | last post: by
2 posts views Thread by Mark Szlazak | last post: by
1 post views Thread by Mickey | last post: by
3 posts views Thread by jimmygoogle | last post: by
1 post views Thread by inteli | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.