[Javascript] Positioning in IE

Peter Brunone peter at brunone.com
Mon Jul 26 09:27:44 CDT 2004


	Just for the record, Hakan's is the most correct answer,
according to the DOM.  Also, you would never assign units to the
pixelLeft property since it takes an integer and assumes pixels... And
if you assign a property with units to the style.left property, you'd
need to feed it in as a string.

Cheers,

Peter

-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu] On Behalf Of Hakan Magnusson
(Backbase)

None of the previous replies, including the ones in your, are conformant

to the DOM standard. In fact, it's not going to work on any browser 
except Internet Explorer, and I have a hard time seeing how 
"glava.style.pixelLeft=500px" could ever work.

I just added my $0.02 in case somebody wanted to do it the RIGHT way, 
and don't want to split their code up more than necessary.

Regards,
H

Troy III Ajnej wrote:
> Or, as Peter had allready repplyed
> 
> document.getElementById('glava').style.pixelLeft =  500
> 
> or even clearer and also many times faster instruction :
> 
> glava.style.pixelLeft=500px
> 
> Ask why if U like Iztok
> 
> 
>> From: "Hakan Magnusson (Backbase)" <hakan at backbase.com>
>>
>>> document.getElementById('glava').style.left =  '500';
>>
>>
>> What unit do you want to use when specifying coordinates? 500 cows,
>> 500 feet or, perhaps, 500 pixels?
>>
>> This could very well be the solution to your problem:
>>
>> document.getElementById('glava').style.left =  '500px';
>>
>> Best regards,
>> H
>>
>>
>> Iztok Polanic wrote:
>>
>>> Hi!
>>>
>>> Here's the <div> element:
>>>
>>> <div style="position:absolute; top:64px; left:190px;" align="center"

>>> id="glava">
>>>
>>>
>>> and here Javascript which tries to move the object:
>>>
>>> document.getElementById('glava').style.left =  '500';
>>>
>>> This works fine in Mozilla (Firerfox) but not in IE 6.
>>>
>>> Bye,
>>>
>>> Iztok -----Original Message-----
>>> From: javascript-bounces at LaTech.edu
>>> [mailto:javascript-bounces at LaTech.edu]
>>> On Behalf Of Flavio Gomes
>>> Sent: 23. julij 2004 17:00
>>> To: [JavaScript List]
>>> Subject: Re: [Javascript] Positioning in IE
>>>
>>>
>>> Well, then you shouldn't have any problems..
>>>    Post your code, please
>>>
>>> Flavio Gomes
>>> flavio at economisa.com.br
>>>
>>>
>>>
>>> Iztok Polanic wrote:
>>>
>>>
>>>> Hi!
>>>>
>>>> Element is <div> tag and it's positioned absolutely.
>>>>
>>>> Bye,
>>>>
>>>> Iztok -----Original Message-----
>>>> From: javascript-bounces at LaTech.edu
>>>> [mailto:javascript-bounces at LaTech.edu]
>>>> On Behalf Of Peter Brunone
>>>> Sent: 23. julij 2004 16:16
>>>> To: '[JavaScript List]'
>>>> Subject: RE: [Javascript] Positioning in IE
>>>>
>>>>
>>>>     What's the element, and is it positioned relatively or 
>>>> absolutely?
>>>>
>>>>     Try style.pixelLeft if you're specifying an integer without 
>>>> units.
>>>>
>>>> -----Original Message-----
>>>> From: javascript-bounces at LaTech.edu 
>>>> [mailto:javascript-bounces at LaTech.edu] On Behalf Of Iztok Polanic
>>>>
>>>> Hi!
>>>>
>>>> I hope this is my last question on positioning on this list :) I'm
>>>> using
>>>> document.getElementById('').style.left to position an element to 
>>>> another
>>>> coordinates. It works fine in firerfox (Mozilla) 0.9 but not in IE
6.0.
>>>> Any clues?
>>>>
>>>> Bye,
>>>>
>>>> Iztok
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Javascript mailing list
>>> Javascript at LaTech.edu 
>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>>
>>> _______________________________________________
>>> Javascript mailing list
>>> Javascript at LaTech.edu 
>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>>
>>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript at LaTech.edu 
>> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu 
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list