471,076 Members | 1,012 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,076 software developers and data experts.

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 2000
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.