Home | Top | Website design | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.


scrollLeft Property

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

Syntax

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

Possible Values

iDistance Integer that specifies or receives the distance, in pixels.

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

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties .

Remarks

This property's value equals the current horizontal offset of the content within the scrollable range. Although you can set this property to any value, if you assign a value less than 0, the property is set to 0. If you assign a value greater than the maximum value, the property is set to the maximum value.

You can set this property inline, but the results might be inconsistent while the page loads.

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

When a marquee object scrolls vertically, its scrollLeft property is set to 0, overriding any script setting.

For more information about how to access the dimension and location of elements on the page through the Dynamic HTML (DHTML) Object Model, see Measuring Element Dimension and Location .

Example

This example uses the scrollLeft property to determine the amount scrolled by the object.

<DIV ID=oDiv STYLE="position:absolute; width:200px; height:100px; overflow:scroll" onclick=alert(this. scrollLeft )>
<SPAN STYLE="width:250px"> . . . </SPAN></DIV>

Standards Information

There is no public standard that applies to this property.

Applies To

Platform Version
Win16: 5
Win32: 5
Unix: 5
Mac: 5
Windows CE: N/A
 
A , ADDRESS , APPLET , B , BDO , BIG , BLOCKQUOTE , BODY , BUTTON , CAPTION , CENTER , CITE , CODE , COL , COLGROUP , CUSTOM , DD , DFN , DIR , DIV , DL , DT , EM , EMBED , FIELDSET , FORM , HEAD , hn , HTML , I , IMG , INPUT type=button , INPUT type=checkbox , INPUT type=file , INPUT type=image , INPUT type=password , INPUT type=radio , INPUT type=reset , INPUT type=submit , INPUT type=text , ISINDEX , KBD , LABEL , LEGEND , LI , LISTING , MARQUEE , MENU , META , NOBR , OBJECT , OL , OPTION , P , PLAINTEXT , PRE , S , SAMP , SCRIPT , SELECT , SMALL , SPAN , STRIKE , STRONG , SUB , SUP , TABLE , TBODY , TD , TEXTAREA , TFOOT , TH , THEAD , TR , TT , U , UL , VAR , XMP
Home | Top | Website design | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.