By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,203 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,203 IT Pros & Developers. It's quick & easy.

Firefox offsetLeft problem

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.