[Javascript] Positioning in IE

Hakan Magnusson (Backbase) hakan at backbase.com
Mon Jul 26 10:30:56 CDT 2004


Well seeing that the original query was regarding positioning that 
worked in Mozilla but didn't work in Internet Explorer, I just thought 
that the best solution would be a future-compatible, browser-independent 
standardised way.

The question was not Microsoft specific. It addressed an issue that only 
occured in Internet Explorer, due to poor conformance to the standards 
by the programmer in question. Rather than repairing this lack of 
knowledge with another proprietary hack, I thought that pointing this 
out, and thus preventing future code soup and avoidable errors, seemed 
to be the best approach.

But again:
> Feel free to use proprietary code with no future compatibility.



Paul Cowan wrote:
> Well seeing as the subject of the thread is 'Positioning in IE', that 
> sounds like a Microsoft specific question to me.
> 
> So unless I have missed the 'hump', I gave an Microsoft IE answer.
> 
> 
> 
> dagda1 at hotmail.com
> 
> 
> 
> 
> 
>> From: "Hakan Magnusson (Backbase)" <hakan at backbase.com>
>> Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
>> To: "[JavaScript List]" <javascript at LaTech.edu>
>> Subject: Re: [Javascript] Positioning in IE
>> Date: Mon, 26 Jul 2004 16:36:38 +0200
>>
>> You are still humping IE-specific, non-standard properties.
>>
>>> 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.
>>
>>
>> Feel free to use proprietary code with no future compatibility.
>>
>> Regards,
>> H
>>
>> Paul Cowan wrote:
>>
>>> What about:
>>>
>>> document.getElementById('glava').style.posLeft = '500px';
>>>
>>>
>>>
>>>
>>> dagda1 at hotmail.com
>>>
>>>
>>>
>>>
>>>> From: "Peter Brunone" <peter at brunone.com>
>>>> Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
>>>> To: "'[JavaScript List]'" <javascript at LaTech.edu>
>>>> Subject: RE: [Javascript] Positioning in IE
>>>> Date: Mon, 26 Jul 2004 09:27:44 -0500
>>>>
>>>>
>>>>     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
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
> 
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 



More information about the Javascript mailing list