doScroll
Method of dom/HTMLElementdom/HTMLElement
Syntax
var object = object.doScroll(/* see parameter list */);
Parameters
component
- Data-type
- VARIANT
A String that specifies how the object scrolls, using one of the following values.
Return Value
Returns an object of type DOM NodeDOM Node
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Examples
The following example uses the doScroll method to scroll down when a button is clicked.
<HEAD>
<SCRIPT>
function scrollBehavior()
{
document.body.doScroll("scrollbarPageRight");
}
function scrollBehavior1()
{
txtScrollMe.doScroll("scrollbarDown");
}
function scrollBehavior2()
{
txtScrollMe.doScroll("scrollbarPageDown");
}
</SCRIPT>
</HEAD>
<BODY>
<BUTTON
onclick="scrollBehavior()"
CLASS="colorIt"
>
Click to Scroll Page
</BUTTON>
<BR>
<HR>
<BUTTON
onclick="scrollBehavior1()"
ondblclick="scrollBehavior2()"
CLASS="colorIt">
Click to Scroll Text Area
</BUTTON><BR><BR>
<TEXTAREA ID=txtScrollMe CLASS="colorIt">
This text area scrolls down when
the "Click to Scroll the Text
Area" button is clicked. The doScroll
method scrolls it as if the down
arrow component of the scroll bar
had been clicked. Double-click the
button to scroll down a whole page.
</BODY>
The following example uses the doScroll method to scroll down a text area in one-second intervals.
<HEAD>
<SCRIPT>
var iTimer;
function timeIt()
{
iTimer = setInterval("scrollIt()", 1000);
}
function scrollIt()
{
oScrollMe.doScroll("down");
}
</SCRIPT>
</HEAD>
<BODY onload="timeIt()">
<DIV ID=oScrollMe STYLE="width:200px;height:75px;overflow:scroll">
</DIV>
</BODY>
Notes
Remarks
As of Windows Internet Explorer 9, this method is supported only for webpages displayed in IE5 (Quirks) mode. For webpages displayed in standards mode (preferred), use the scrollLeft and scrollTop properties. The doScroll method is available on all objects, regardless of whether they support scrollbars. Cascading Style Sheets (CSS) allow you to scroll on all objects through the overflow property. When the content of an element changes and causes scroll bars to display, the doScroll method might not work correctly immediately following the content update. When this happens, you can use the setTimeout method to enable the browser to recognize the dynamic changes that affect scrolling.
Syntax
Standards information
There are no standards that apply here.
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]