共用方式為


time Behavior (deprecated)

This page documents a feature of HTML+TIME 1.0, which was released in Microsoft® Internet Explorer 5. We recommend that you migrate your content to the latest version of HTML+TIME, which implements the SMIL 2.0 Working Draft. See the Introduction to HTML+TIME overview for more information.

Provides an active timeline for an HTML element.

Syntax

XML
		&lt;<code>t</code>:

PredefinedTag ID=sID STYLE="behavior:url('#default#time')" />

HTML <ELEMENT STYLE="behavior:url('#default#time')" ID=sID>
Scripting object.style.behavior = "url('#default#time')"
object.addBehavior ("#default#time")

Possible Values

t Prefix required by the time behavior. This prefix is set using the XMLNS attribute of the HTML
PredefinedTag One of the following predefined tags:
audioDefines a timed audio element in an HTML document.
imgDefines a timed image element in an HTML document.
mediaDefines a generic, timed media element in an HTML document.
parDefines a new timeline container in an HTML document for independently timed elements.
seqDefines a new timeline container in an HTML document for sequentially timed elements.
videoDefines a timed video element in an HTML document.
sID String that specifies a unique identifier for the object.

Members Table

The following table lists the members exposed by the time object.

Attribute Property Description
t:ACCELERATE accelerate

Sets or gets a value that applies an acceleration to the element's local timeline.

t:AUTOREVERSE autoReverse

Sets or gets whether the timeline on an element immediately begins playing in reverse after completing in the forward direction.

t:BEGIN begin

Sets or gets the delay time before the timeline begins playing on the element.

t:BEGINAFTER beginAfter

Sets or gets a value indicating that the timeline of an element starts when the referenced element ends.

t:BEGINEVENT beginEvent

Sets or gets a value that starts the timeline of an element when the referenced event occurs.

t:BEGINWITH beginWith

Sets or gets a value that starts an element timeline at the same time as the referenced element.

currTime

Gets a value indicating the current time on the simple duration as defined by the element's t:DUR attribute or the t:END attribute.

t:DECELERATE decelerate

Sets or gets a value that applies a deceleration to the end of a simple duration.

t:DUR dur

Sets or gets a value indicating the amount of time the element remains active or displayed.

t:END end

Sets or gets a value indicating the end time for the element, or the end of the simple duration when the element is set to repeat.

t:ENDEVENT endEvent

Sets or gets a value indicating that the timeline of an element ends immediately when the referenced event occurs, regardless of the element's repeat count or repeatDur property.

t:ENDHOLD endHold

Sets or gets whether an element remains active if its timeline ends before the timeline on its parent element ends.

t:EVENTRESTART eventRestart

Sets or gets whether the element should restart if a beginEvent call occurs while the local timeline is already running.

localTime

Gets a value indicating the current time along the local duration, as defined by the element's t:REPEAT atribute or t:REPEATDUR attribute.

progressBehavior

Gets an object indicating the progress of the specified Microsoft DirectAnimation behavior.

t:REPEAT repeat

Sets or gets the number of times an element timeline repeats.

t:REPEATDUR repeatDur

Sets or gets the number of seconds an element timeline repeats.

t:SYNCBEHAVIOR syncBehavior

Sets or gets the synchronization rules for the element timeline.

syncTolerance

Gets the time variance allowed on a timeline with locked synchronization.

t:TIMEACTION timeAction

Sets or gets the action that is taken on the element while the timeline is active.

t:TIMELINE timeline

Sets or gets the type of timeline associated with an HTML element.

timelineBehavior

Gets a DirectAnimation number object containing the timeline behavior associated with the specified object.

t:TIMESTARTRULE timeStartRule Sets or gets the point at which the document timeline begins.
Event Property Description
onbegin

Fires when the timeline starts on an element.

onend

Fires when the timeline stops on an element.

onpause

Fires when the timeline on an element pauses.

onrepeat

Fires when the timeline repeats on an element, beginning with the second iteration.

onresume

Fires when an element's timeline resumes from a paused state.

onreverse

Fires when the timeline on an element begins to play backward.

Method Description
beginElement

Starts the element on the timeline.

endElement

Stops the element on the timeline.

Remarks

This default behavior adds timing to HTML pages. Using the HTML+TIME extensions, any HTML element can be set to appear at a given time, last for a specified duration, and repeat the behavior if desired. The time behavior supports all time-related attributes, properties, methods, and events. The XML elements associated with this behavior are t:AUDIO, t:IMG, t:MEDIA, t:PAR, t:SEQ, and t:VIDEO.

The members listed in the preceding table might not be accessible through scripting until the window. onload event fires. Waiting for this event to fire ensures that the page is completely loaded, that all behaviors have been applied to corresponding elements on the page, and that all the behavior's properties, methods, and events are available for scripting. Using any of the behavior-defined members before the window. onload event fires could result in a scripting error, indicating that the object does not support that particular member.

The time behavior is available as of Microsoft Internet Explorer 5, only in the Microsoft Win32 platform.

Example

This example uses the time behavior to make text appear for specified intervals of time.

<HTML>
<HEAD>
<TITLE>Time Behavior</TITLE>
<XML:NAMESPACE PREFIX="t"/>
<STYLE>
  .time  { behavior: url(#default#time);}
</STYLE>
</HEAD>
<BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF" 
LINK="#000000" VLINK="#808080" ALINK="#000000">
<BLOCKQUOTE>
<P>Images and lines of text should start appearing 2 seconds 
after the page is loaded.</P>
<t:IMG CLASS=time t:BEGIN="2" t:DUR="7" t:TIMEACTION="display" 
    t:SRC="/workshop/graphics/icons/author.gif" />
<t:IMG CLASS=time t:BEGIN="11" t:DUR="indefinite" t:TIMEACTION="display" 
    t:SRC="/workshop/graphics/icons/messaging.gif" />
<UL STYLE="COLOR:Green;">
    <LI CLASS=time t:BEGIN="2" t:DUR="7" t:TIMEACTION="display">
        This line appears with the image.
    </LI>
    <LI CLASS=time t:BEGIN="4" t:DUR="5" t:TIMEACTION="display">
        This line appears two seconds after the image.
    </LI>
    <LI CLASS=time t:BEGIN="6" t:DUR="3" t:TIMEACTION="display">
        This line appears four seconds after the image.
    </LI>
</UL>
<UL STYLE="COLOR:Red;">
    <LI CLASS=time t:BEGIN="11" t:DUR="indefinite" 
    t:TIMEACTION="display">
        This line appears with the image.
    </LI>
    <LI CLASS=time t:BEGIN="13" t:DUR="indefinite" 
    t:TIMEACTION="display">
        This line appears two seconds after the image.
    </LI>
    <LI CLASS=time t:BEGIN="15" t:DUR="indefinite" 
    t:TIMEACTION="display">
        This line appears four seconds after the image.
    </LI>
</UL>
<P CLASS=time t:BEGIN="16" t:DUR="indefinite">The page is now 
finished.</P>
</BLOCKQUOTE>
</BODY>
</HTML>

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

Applies To

A, ABBR, ACRONYM, ADDRESS, AREA, B, BIG, BLOCKQUOTE, BUTTON, CAPTION, CENTER, CITE, CODE, DD, DEL, DIR, DIV, DL, DT, EM, FIELDSET, FONT, FORM, hn, HR, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, KBD, LEGEND, LI, LISTING, MARQUEE, MENU, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP

See Also

Introduction to DHTML Behaviors, Introduction to HTML+TIME, Using DHTML Behaviors, time2