HBCMS更多的中文手册参考:

Introduction to HTML+TIME

DHTML文档教程

HTML+TIME (Timed Interactive Multimedia Extensions), first released in Microsoft?Internet Explorer 5, adds timing and media synchronization support to HTML pages. Using a few Extensible Markup Language (XML)-based elements and attributes, you can add images, video, and sounds to an HTML page, and synchronize them with HTML text elements over a specified amount of time. In short, you can use HTML+TIME technology to quickly create multimedia-rich, interactive presentations, easily and with little or no scripting.

HTML+TIME 2.0 is based on the html+smil language profile non-microsoft link in the synchronized multimedia integration language (smil) 2.0 non-microsoft link working draft. smil 2.0 is the w3c successor to smil 1.0. html+time 2.0 is the successor to html+time 1.0.

Note  HTML+TIME 2.0 is available in minimal installations of Internet Explorer 5.5 and Internet Explorer 6.

This article covers the following topics:

benefits

the following section contains information about the benefits of using html+time.

dynamic content

you can use html+time to add dynamic, interactive content to your web pages. for example, you can create slide-show-style web presentations with synchronized text, images, audio, video, and streaming media. you can create these presentations so that they are timed, interactive, or a combination of both.

ease of use

to add timing to an html document, all you have to do is add some new attributes to existing html elements. thus, you can leverage your existing html knowledge when you add timing to your page. the html+time attributes specify when an element appears on a page, how long it remains displayed, and how the surrounding html elements are affected. in addition to the attributes, some new xml-based elements have been created to simplify incorporating media into web pages. for example, you can use the excl element to specify when a sound file should start playing, when it should stop, and how many times it should repeat.

html elements can be grouped into hierarchical relationships to allow for easy manipulation of multiple html elements at once. grouping is also used to specify whether html elements appear and disappear sequentially on the page, or use independent timing. element grouping is specified either by using the t:par, t:seq, or t:excl elements in a document, or by setting the timecontainer attribute.

scripting support

with html+time, you can use persistent xml elements and attributes to add timing to your html page. this means you don't have to know how to program with scripting languages to make your pages more dynamic. however, for people who already know how to use scripting languages, html+time supports a complete object model that extends the existing dhtml object model. thus, you can use html+time properties, methods, and events to add even more interactive features to your web pages.

html+time behaviors and elements

html+time is implemented as a dhtml default behavior, one of the powerful new features introduced in internet explorer 5. for more information about behaviors, see the related topics section of this document.

you can use all the html+time attributes listed in the reference pages with any timed html element. for a list of html elements that can be timed, see the applies to section of the time and time2 behavior reference pages.

internet explorer 5.5 update

the html+time 2.0 reference lists the features implemented by the time2 behavior and supported in internet explorer 5.5 and later.

the html+time 1.0 reference lists the features implemented by the time behavior and supported in internet explorer 5 and later.

html+time timing model

most traditional animation runtime systems use either rigid timelines or pure, event-based relationships to model time. the rigid timeline model makes it more difficult to create interactive content. in this environment, you must add "jumps" to another pseudo-timeline to introduce interactive elements. in event-based models, interaction is easier to define, but it is more difficult to create timeline behaviors, such as sequences and precise synchronization of media elements.

html+time unifies these two timing models, taking the best of each and simplifying the process of authoring timed, interactive content. in the html+time model, you can use timeline attributes to describe static, or determinate, timeline relationships. this makes it easy to place elements in time and to ensure synchronization among media elements. you can author interactive content using a simple variant on the timeline attributes, where the begin and/or end times are tied to an event. therefore, the actual begin and/or end values are indeterminate when you author the document. in reality, these times are event-based, but they can be defined as though they had traditional timing. when the associated event occurs, such as a user clicking a button, the indeterminate timing relationship is defined by the time at which the event occurs. at this point, the element is added into the running timeline as though it had been defined from the beginning.

this unified model makes it easy to define an animation that has tightly synchronized media, and to add a number of interactive elements that start when the user does something. the interactive elements can have a duration and repeat count just like other timed elements, even though they begin in response to an event. you can apply a single set of tools for timing and synchronization to any element. this makes the model easier to learn and less complicated, without sacrificing any flexibility.

html+time defines a schedule, or timeline, for all the affected elements to follow. the document timeline starts as soon as the page loads and continues to progress as long as the browser renders the page. if timing is applied to media elements, such as audio or video files, you can specify that the timeline will be tightly synchronized with other elements or the entire document. by default, media files that are not ready to play when scheduled will slip along the timeline and begin playing as soon as they become available. you can pause and resume the document timeline using methods from the object model.

html elements behave differently when you add time attributes, depending on the html element type. although other categories might exist for html elements, html+time primarily distinguishes between content and style elements. content elements include all elements that describe content to be displayed on the page, including the media elements introduced with html+time (t:animation, t:audio, t:img, t:media, and t:video. commonly used content elements include p, div, span, and table-related elements. adding html+time attributes to a content element causes the element to appear and disappear over time. style elements describe the style to be applied to an element. commonly used style elements include b, i, and em. adding html+time attributes to a style element causes the style to be applied to and removed from the element over time. for more information about style elements, see the html+time implementation notes section of this document.

authoring html+time

use the following steps to add timing to an html element.

create an xml namespace

when using any of the html+time elements, such as the t:excl, t:seq or t:par elements, you must declare the xml namespace t: in the html tag, as shown in the following line of code:

<html xmlns:t ="urn:schemas-microsoft-com:time">

to use the namespace, preface html+time elements with t:. this string identifies the html+time elements as qualified xml namespace extensions. to establish t: as the namespace, import the time2 behavior into the namespace as shown in the following line of code:

<?import namespace="t" implementation="#default#time2">

reference the time2 behavior

you must associate the element with the time2 behavior, so that the element is affected by the document timeline. to accomplish this, you can add the inline style attribute to the html element as follows:

<p style="behavior:url(#default#time2)" ...>

however, you might find it easier to associate an element with the time2 behavior by creating a cascading style sheets (css) class attribute, as shown in the following sample:

<HTML>
<HEAD>
<STYLE>
.time    {behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY>
.
.
.
<P CLASS="time" ...>
.
.
.
</BODY>
</HTML>
Note  It is not necessary to associate the time2 behavior with HTML+TIME elements, such as t:MEDIA, t:AUDIO, and t:VIDEO, because they are defined by the behavior itself.

Specify Beginning and Ending Times

You must specify when the HTML element should appear and for how long. This is accomplished by including the begin and end attributes on the element. you can use the dur attribute instead of end to specify an ending time relative to the element's begin time. however, there is no functional difference between end and dur, so you can use either one. if you do not set a begin, end, or dur time, the default value causes an element to begin displaying when the page loads, and the element remains displayed indefinitely. therefore, the element appears static, as though you have not set any timing on that element.

the following sample shows lines of text that appear every two seconds and remain displayed for five seconds.

<HTML>
<HEAD>
<STYLE>
.time    {behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY>
<P>This text appears right away. More lines to follow...</P>
<P CLASS="time" BEGIN="2" DUR="5" >This appears after 2 seconds.</P>
<P CLASS="time" BEGIN="4" DUR="5">This appears after 4 seconds.</P>
<P CLASS="time" BEGIN="6" DUR="5">This appears after 6 seconds.</P>
<P>This is the last line.</P>
</BODY>
</HTML>
This feature requires Microsoft?Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

include an action

although including an action is optional, you might want to use the timeaction attribute to specify the action that is taken while the element is active on the timeline. in the dhtml object model, two properties are available on the style object for turning on and off the display of an element. html+time changes the value of these properties over time. with dhtml, you can set the visibility property to hidden or visible. this property reserves space in the layout of the rendered document, as though the element is always visible. therefore, the document does not reflow its contents as elements are dynamically displayed or hidden.

the default behavior for using html+time on a content element is timeaction="visibility". in contrast, when the dhtml display attribute is set to none it does not reserve space in the rendered document. therefore, the document reflows every time the value of the display attribute changes. to reflow the document using html+time, set the timeaction attribute to display.

as an alternative to displaying and hiding an element, you can set the timeaction attribute to style to make an inline style active on an element. if you use this option, any style property included on the element using the style attribute is applied only while the element is active on the timeline; otherwise, the inline style is ignored. as of internet explorer 5.5, you can also modify the style of an element by specifying one or more class names for the timeaction attribute.

when using a time container, you can set the timeaction attribute to none so that it performs no action. when this attribute is set to none, only the child elements of the time container are visually affected while the timeline is active. if an element supports a boolean on property, you can use a timeaction value of onoff to make the on property true while the timeline is active on the element, or false otherwise.

the following sample shows lines of text that appear every two seconds and remain displayed for five seconds. this is similar to the previous sample, but in this case the document reflows, as necessary, because the timeaction attribute is set to display. the timeaction attribute is set to style on the heading.

<HTML>
<HEAD>
<STYLE>
.time    {behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY>
<H1 CLASS="time" BEGIN="0" DUR="11" TIMEACTION="style" STYLE="Color:Red;">timeAction</H1>
<P>This text appears right away. More lines to follow...</P>
<P CLASS="time" BEGIN="2" DUR="5" TIMEACTION="display">This appears after 2 seconds.</P>
<P CLASS="time" BEGIN="4" DUR="5" TIMEACTION="display">This appears after 4 seconds.</P>
<P CLASS="time" BEGIN="6" DUR="5" TIMEACTION="display">This appears after 6 seconds.</P>
<P>This is the last line.</P>
</BODY>
</HTML>
This feature requires Microsoft?Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

exclusive, sequential and parallel time container elements

you can use html+time to specify timing for individual elements displayed on the page. you can also use it to create a timeline that groups elements together and specifies their timing relative to each element's predecessor in the timeline. the following example uses the timecontainer attribute set to excl to create a time container that allows only one element to play at a time.

<HTML>
<HEAD>
<STYLE>
.time    {behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY>
<DIV CLASS="time" TIMECONTAINER="excl">
<DIV CLASS="time" BEGIN="0" DUR="2" TIMEACTION="display">First line of text.</DIV>
<DIV CLASS="time" BEGIN="2" DUR="2" TIMEACTION="display">Second line of text.</DIV>
<DIV CLASS="time" BEGIN="4" DUR="2" TIMEACTION="display">Third line of text.</DIV>
<DIV CLASS="time" BEGIN="6" TIMEACTION="display">Fourth line of text.</DIV>
</DIV>
</BODY>
</HTML>
This feature requires Microsoft?Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

you can easily create slide-show-style presentations using timing sequences to display a series of images, one after the other, along with synchronized text. the following example uses the timecontainer attribute to create a sequential time container.

<HTML>
<HEAD>
<STYLE>
.time    {behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY>
<DIV CLASS="time" TIMECONTAINER="seq">
<DIV CLASS="time" DUR="2" TIMEACTION="display">First line of text.</DIV>
<DIV CLASS="time" DUR="2" TIMEACTION="display">Second line of text.</DIV>
<DIV CLASS="time" DUR="2" TIMEACTION="display">Third line of text.</DIV>
<DIV CLASS="time" TIMEACTION="display">Fourth line of text.</DIV>
</DIV>
</BODY>
</HTML>
This feature requires Microsoft?Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

you must declare the duration of each element in the sequence. since the duration is omitted on the last element, it remains displayed indefinitely. grouping the elements in a sequence makes it easy to manipulate the entire group of elements at once, rather than individually. for example, you can add the begin attribute to the sequence time container to make the entire sequence wait before it begins playing.

if you want to group elements without displaying them in a sequence, you can create a parallel timeline by setting the timecontainer attribute to par on the time container element. in contrast to a sequence, you can use parallel timelines to display and hide elements without any implicit dependencies on other elements. this allows more than one element to be active on the timeline, and you can have as few or as many elements active on the timeline as you want梩here is no minimum or maximum requirement. the following sample shows how a parallel timeline is used for repeating a group of elements with overlapping timelines.

<HTML>
<HEAD>
<STYLE>
.time    {behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY>
<DIV CLASS="time" REPEATCOUNT="5" DUR="10" TIMECONTAINER="par">
<DIV CLASS="time" BEGIN="0" DUR="4">First line of text.</DIV>
<DIV CLASS="time" BEGIN="2" DUR="4">Second line of text.</DIV>
<DIV CLASS="time" BEGIN="4" DUR="4">Third line of text.</DIV>
<DIV CLASS="time" BEGIN="6" DUR="4">Fourth line of text.</DIV>
</DIV>
</BODY>
</HTML>
This feature requires Microsoft?Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

instead of using the timecontainer attribute to group html elements on a timeline, you can use the t:par or t:seq elements. for example, in the previous sample that shows a sequence, you could have used the t:seq element instead of the div to yield the same results.

the following example declares the xml namespace t: in the html tag and imports the time2 behavior into that namespace because it uses the t:seq custom element.

<html xmlns:t ="urn:schemas-microsoft-com:time">
<HEAD>
<STYLE>
.time    {behavior: url(#default#time2);}
</STYLE>
<?IMPORT namespace="t" implementation="#default#time2">
</HEAD>
<BODY>
<t:SEQ>
<DIV CLASS="time" DUR="2">First line of text.</DIV>
<DIV CLASS="time" DUR="2">Second line of text.</DIV>
<DIV CLASS="time" DUR="2">Third line of text.</DIV>
<DIV CLASS="time">Fourth line of text.</DIV>
</t:SEQ>
</BODY>
</HTML>
This feature requires Microsoft?Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

compatibility

html+time features are available as of internet explorer 5 and are not supported in earlier browser versions. if an earlier version of internet explorer or a non-internet explorer browser encounters a reference to a behavior, the style is ignored, and the element is rendered as normal on the page. however, scripting errors might occur in cases where the behavior being used exposes properties, methods, or events. to address these errors, you need to use some version-checking script.

Note  HTML+TIME works only if Internet Explorer 5 is installed with the typical set of components. If the minimal installation is used, HTML+TIME content is rendered statically, as though no timing has been defined.

Internet Explorer 5.5 Update

All of the features of the time behavior are still available in Internet Explorer 5.5. However, we strongly recommend that you begin using the time2 behavior, which implements the HTML+SMIL language profile as defined in the working draft of the SMIL 2.0 specification.

HTML+TIME Implementation Notes

The following list contains information about the initial version of HTML+TIME in Internet Explorer 5, including differences between this implementation and the W3C submission.

html+time newsgroup

the html+time newsgroup is a forum for users to share ideas, ask questions, and relay comments about html+time. the newsgroup is intended for user-to-user support; however, microsoft does monitor it for product-feedback purposes. to access the newsgroup, use the following information with your favorite newsgroup reader.

related topics