You are here: Reference > JavaScript > client-side > HTML DOM > methods > clearTimeout (window)

clearTimeout method (window)

Browser support:
Clears the delayed action that was previously set by the setTimeout method.
If the action was registered with the setInterval method, use the clearInterval method to remove it.

Syntax:

object.clearTimeout (timeoutID);
You can find the related objects in the Supported by objects section below.

Parameters:

timeoutID
Required. Integer that specifies the identifier of the timer returned by the setTimeout method.

Return value:

This method has no return value.

Example HTML code 1:

This example illustrates the use of the clearTimeout method:
<head>
    <script type="text/javascript">
        var idx = 0;
        function SetDelay () {
            delayTime = setTimeout ("Counter ()",200);
        }
        function Counter () {
            document.getElementById ("textAr").innerHTML += idx;
            idx++;
            if (idx>9) {
                clearTimeout (delayTime);
            }
        }
    </script>
</head>
<body>
    <button onclick="SetDelay ();">Click to count!</button>
    <textarea id="textAr"></textarea>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content