asp.net.ph

Skip Navigation Links

scrollLeft Property

Language References


Sets or retrieves the distance between the left edge of the object and the leftmost portion of the object that is currently visible in the window.

Syntax


HTML N/A
Script object.scrollLeft [ = iDistance ]

Possible Values


iDistance Integer value representing the distance, in pixels.

The property is read/write with a default value of 0.

Remarks

The property's value is equal to the horizontal distance that the content of the object has been scrolled. Although the value can be set to any positive or negative value, if the assigned value is less than zero, the property is set to zero. If the assigned value is greater than the maximum possible, the property is set to the maximum possible.

This property can be set inline but the results may not be consistent while the page is loading.

This property is always zero for objects that do not have scroll bars. For these objects, setting the property has no effect.

When a MARQUEE object is scrolling vertically its scrollLeft property is set to zero, overriding any script setting.

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 example shows how the scrollLeft property can be used to determine the amount of scrolling done by an object.

<div style="width:300px; height:150px;
  overflow:scroll"
  onclick="alert ( this.scrollLeft )">
<span style="width:350px;background:maroon">
  The text in this box ... </span></div>

This feature requires Microsoft® Internet Explorer® 4.0 or later.

 Show me 

See Also

scrollHeight, scrollTop, scrollWidth



>

© 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