473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 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 2094
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Keith Thornhill | last post by:
I'm trying to calculate the top and left distance from the side of the browser of an object (either absolutely or relatively positioned) and i'm running into a weird problem as i'm trying to make...
2
by: Mark Szlazak | last post by:
The following code fails in Firefox to get at selected text in the right-side textarea. Any help would be appreciated. <html> <head> <script> var agt = navigator.userAgent.toLowerCase();...
1
by: Mickey | last post by:
Hi, I have a script which works in both IE but is sluggish in Firefox. The script is a simple text scroller. It works perfectly in IE however in Firefox, the text scroll slower and eventually...
3
by: jimmygoogle | last post by:
I posted earlier with a scope problem. I think I resolved it in IE but in Firefox it still exists. Anyone have any ideas/experience with this? I attached my code sorry it is so long. You can...
10
by: Matt Kruse | last post by:
See: http://www.mattkruse.com/temp/offsetleft.html It appears that the offsetLeft value in IE6 (other versions not tested) incorrectly ignores the border width on a DIV when there is a width:...
1
by: chris1606 | last post by:
This script floats one image over another (to conterract transparency). It works fine in Opera and Internet Explorer, but the image won't move in firefox. Any ideas how I can get it to work please? ...
1
by: inteli | last post by:
Hey anybody can help me out wid this code..Its working well in IE but nt in firefox.The problem lies in offset,clientX,clientY part but I dnt know how to resolve it .. var zxcDockAry=new Array();...
1
by: ehud37new | last post by:
this script work fine in IE but not in FireFox where is the problem? here is the script /*------------------------------------------------------------------ File: menu.js ...
1
by: xtremebass | last post by:
Hello Bytes, i have a calender program which is created by using Javascript. when i execute that program using Internet Explorer,it works properly but when i tried in Mozilla firefox it didnt...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.