Language References
Sets or retrieves the left position of the object in the units specified by the CSS left attribute.
HTML |
N/A |
Script |
object.style.posLeft [ = fLeft ] |
fLeft |
Any valid floating-point number. |
The property is read/write with no default value.
This property reflects the value of the CSS left attribute for positioned items. This property always returns zero for nonpositioned items because "left" is not meaningful unless the object is positioned. Use the offsetLeft property to calculate actual positions within the document area.
Setting this property changes the value of the left position but leaves the units designator for the property unchanged.
Unlike the left property, this property's value is a floating-point number, not a string.
For more information on how to access the dimension and location of elements on the page through the document object model, see Measuring Element Dimension and Location.
The following JScript® ( compatible with ECMA-262 language specification ) example moves the first IMG object left by 10 units.
document.all.tags ( "IMG" ).item ( 0 ).style.posLeft -= 10;
In the following sample, the posLeft is incremented through use of a timer.
<script language="JavaScript">
function moveThis ( ) {
:
if ( sphere.style.posLeft<900 ) {
sphere.style.posTop += 2;
sphere.style.posLeft += 2;
window.setTimeout ( "moveThis ( );", 1 );
}
}
...
</script>
This feature requires Microsoft® Internet Explorer® 4.0 or later.
Show me
pixelLeft