Compartilhar via


DUR Attribute | dur Property

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

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

Syntax

HTML <ELEMENT DUR = sTime... >
Scripting [ sTime = ] object.dur

Possible Values

sTime String that specifies one of the following values.
indefinite
Element remains active on the timeline for an indefinite amount of time.
duration
Amount of time the element remains active or displayed. The time must be specified as described in Time Formats.

The property is read/write. The property has no default value.

Remarks

Any media tag, such as img or media, has a default DUR value based on the type of media. For movies, audio, and animated GIFs, the default DUR is built into the media and can be determined by calling the mediaDur property. For static images, the default DUR value is zero seconds. When used with any other type of element, the default value for DUR is indefinite.

The DUR attribute is a value relative to the value of the BEGIN attribute of the element. In contrast, the END attribute represents an absolute value along the parent element timeline, starting at zero seconds. Do not use the DUR attribute on the same element as the END attribute.

For Microsoft DirectMusic, if you set dur to zero on a playing segment, it stops playing at the end of the next measure.

The dur property is read-only on the playItem object.

Example

This example uses the DUR attribute to display lines of text for different amounts of time.

<HTML XMLNS:t ="urn:schemas-microsoft-com:time">
<HEAD>
<STYLE>
    .time{ behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY BGCOLOR="white">
<SPAN CLASS=time STYLE="COLOR:Red;" BEGIN="0" DUR="5"
    TIMEACTION="visibility">
    <H3>Paragraph 1</H3>
    <P>This is paragraph number one. It displays for five
    seconds.</P>
</SPAN>
<SPAN CLASS=time STYLE="COLOR:Blue;" BEGIN="0" DUR="10"
    TIMEACTION="visibility">
    <H3>Paragraph 2</H3>
    <P>This is paragraph number two. It displays for ten
    seconds.</P>
</SPAN>
<SPAN CLASS=time STYLE="COLOR:Green;" BEGIN="0" DUR="indefinite"
    TIMEACTION="visibility">
    <H3>Paragraph 3</H3>
    <P>This is paragraph number three. It displays
    indefinitely.</P>
</SPAN>
</BODY>
</HTML>

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

Applies To

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

See Also

Introduction to HTML+TIME, activeDur, mediaDur, repeatDur, segmentDur, simpleDur