共用方式為


beginElementAt Method

This topic documents a feature of HTML+TIME 2.0, which is obsolete as of Windows Internet Explorer 9.

Starts an element's timeline at the specified time.

Syntax

object.beginElementAt(iSeconds)

Parameters

iSeconds Required. A String that specifies the point along the element's parent timeline at which to start playing the element.

Return Value

No return value.

Remarks

The element's timeline will start at the time specified by the beginElementAt method if beginElementAt is invoked at any time before the parent element reaches that specified time. Otherwise, the element's timeline will start immediately. If beginElementAt is invoked on an element's timeline more than once with a value that is the same or less than the previous value used, it will be ignored.

Example

This example shows how to use the beginElementAt method to start an element's timeline at a specified time.

<HTML XMLNS:t ="urn:schemas-microsoft-com:time">
<HEAD>
<TITLE>beginElementAt Method</TITLE>

<SCRIPT>
function doBegin(){
    <!-- Validate input from user. -->
    if(secondToStart.value<=document.body.currTimeState.activeTime
        || secondToStart.value==null){
        alert('Must be an integer greater than document timer value!\nPlease enter value again.');
        secondToStart.value='';
        secondToStart.focus();
        return;
    }
        t1.beginElementAt(secondToStart.value);
}
</SCRIPT>
<STYLE>
    .time{ behavior: url(#default#time2);}
</STYLE>
</HEAD>

<BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF" LINK="#000000"
    VLINK="#808080" ALINK="#000000">
<B>Document Timer:</B>
<SPAN id="Timer" class="time" dur=".01" repeatCount="indefinite" fill="hold"
    onrepeat="innerText=parseInt(document.body.currTimeState.activeTime);">0</SPAN><BR>

<B>Time Container Timer:</B>
<SPAN id="Timer" class="time" dur=".01" repeatCount="indefinite" fill="hold"
    onrepeat="innerText=parseInt(t1.currTimeState.activeTime);">0</SPAN><BR><BR>

<!-- The time container begins upon document.body.onload. By entering a value
    in the begin element input box, you cause the time container to 
    start over at a certain time in the document.body.currTimeState.activeTime.-->  
<t:excl id="t1" begin="0" class="time" dur="27">
    <DIV id="s1" CLASS="time" STYLE="Color:Red; font-size:20pt;" begin="1" DUR="5">
        First line displayed for 5 seconds.</DIV>
    <DIV id="s2" CLASS="time" STYLE="Color:Green; font-size:20pt;" begin="6" DUR="5">
        Second line displayed for 5 seconds.</DIV>
    <DIV id="s3" CLASS="time" STYLE="Color:Blue; font-size:20pt;" begin="11" DUR="5">
        Third line displayed for 5 seconds.</DIV>
    <DIV id="s4" CLASS="time" STYLE="Color:Orange; font-size:20pt;" begin="16" DUR="5">
        Fourth line displayed for 5 seconds.</DIV>
    <DIV id="s5" CLASS="time" STYLE="Color:Purple; font-size:20pt;" begin="21" DUR="5">
        Last line displayed </DIV>
</t:excl>

Point in document time to start (must be a positive integer):
<INPUT type="number" name="secondToStart" size="3" />
<BUTTON ID="b1" onclick="doBegin()">Click here</BUTTON>
</BODY>
</HTML>

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

Applies To

t:TRANSITIONFILTER, t:ANIMATE, t:ANIMATECOLOR, t:ANIMATEMOTION, t:ANIMATION, t:AUDIO, t:IMG, t:MEDIA, t:PAR, t:REF, t:SEQ, t:SET, time2, t:VIDEO

See Also

beginElement, endElementAt, Introduction to HTML+TIME