asp.net.ph

Skip Navigation Links

posLeft Property

Language References


Sets or retrieves the left position of the object in the units specified by the CSS left attribute.

Syntax


HTML N/A
Script object.style.posLeft [ = fLeft ]

Possible Values


fLeft Any valid floating-point number.

The property is read/write with no default value.

Remarks

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.

Example

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 

See Also

pixelLeft



>

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note