Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Firefox offsetLeft problem

Reply
Thread Tools

Firefox offsetLeft problem

 
 
Gary Coutts
Guest
Posts: n/a
 
      03-22-2006
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


 
Reply With Quote
 
 
 
 
Bruce Barker
Guest
Posts: n/a
 
      03-23-2006
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
Gary Coutts
Guest
Posts: n/a
 
      03-24-2006
Thanks for the reply. It's a good article.


Cheers

Gary

"Bruce Barker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox offsetLeft Paul Nash Javascript 1 06-09-2006 09:59 AM
Safari offsetParent/offsetLeft Problem! ara.pehlivanian@gmail.com Javascript 3 01-13-2005 11:12 PM
offsetLeft/Top Bug in Firefox? (value is 8) Keith Thornhill Javascript 4 08-16-2004 09:04 PM
Different offsetLeft/Top calculation for elements contained in DIV and TABLE/TD Pieter Van Waeyenberge Javascript 2 02-16-2004 02:21 PM
offsetLeft & Top differ for different element types? Pieter Van Waeyenberge Javascript 0 02-15-2004 04:31 PM



Advertisments