Partager via


repeatCount property

Gets the current iteration in the repetition loop.

Syntax

JScript
count = object.repeatCount

 

Property values

Type: Integer

the current iteration in the repetition loop.

Remarks

This is a read-only property that is exposed by the currTimeState object. You can access the repeatCount property at run time to determine the current iteration of a repetition loop. A repetition loop is created by setting the repeatCount property.

Examples

This example uses the repeatCount property to get the current iteration.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/repeatcount.htm

<HTML XMLNS:t ="urn:schemas-microsoft-com:time">
<HEAD>
<?IMPORT namespace="t" implementation="#default#time2">

<STYLE>
    .time{ behavior: url(#default#time2);}
</STYLE>

<SCRIPT LANGUAGE="JScript">
function fnRepeat()
{
    oCount.innerText = "Current iteration: " +
        (oAnim.currTimeState.repeatCount + 1); 
        // Add one because repeatCount is zero-based.
}
</SCRIPT>
</HEAD>

<BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF"
    LINK="#000000" VLINK="#808080" ALINK="#000000">

<DIV ID="oCount">Current iteration: 1</DIV>

<DIV ID="oDiv" CLASS="time" STYLE="position:relative;top:25px;left:50px;
    height:100px;width:100px;background-color:blue;"></DIV>

<t:ANIMATEMOTION ID="oAnim" targetElement="oDIV" to="150,0"
    begin="0;indefinite" dur="1" autoReverse="true" repeatCount="5"
    onrepeat="fnRepeat()"/>

<BR><BR>
<BUTTON id="b1" onclick="oCount.innerText='Current iteration: 1';
    oAnim.beginElement();">Click to restart</BUTTON>
</BODY>
</HTML>

See also

currTimeState

Reference

repeatDur

Conceptual

Introduction to HTML+TIME