spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column67


Introduction to HTML+TIME

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

Playing Elements in Sequence

You can group HTML elements by wrapping them in an HTML container like the DIV element. You can then apply HTML+TIME attributes to the whole group. One attribute is TIMELINE="seq" which instructs the browser to play members of the group one after the other. According to Microsoft, one would think that the following code should work:

<HTML>
<HEAD>
<TITLE>Simple HTML+TIME Example</TITLE>
<STYLE>
  .mytime {behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY>
<DIV CLASS="mytime" TIMELINE="seq">
  <IMG CLASS="mytime" SRC="slide1.gif" DUR="7"
   TIMEACTION="display">
  <IMG CLASS="mytime" SRC="slide4.gif" DUR="7"
   TIMEACTION="display"><BR>
  <IMG CLASS="mytime" SRC="slide5.gif" DUR="7"
   TIMEACTION="display">
  <IMG CLASS="mytime" SRC="slide6.gif" DUR="7"
   TIMEACTION="display">
</DIV>
</BODY>
</HTML>

But it doesn't. The trick is to replace the TIMELINE attribute with the TIMECONTAINER attribute. Try it now. Here is the code:

<HTML>
<HEAD>
<TITLE>Simple HTML+TIME Example</TITLE>
<STYLE>
  .mytime {behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY>
<DIV CLASS="mytime" TIMECONTAINER="seq">
  <IMG CLASS="mytime" SRC="slide1.gif" DUR="7"
   TIMEACTION="display">
  <IMG CLASS="mytime" SRC="slide4.gif" DUR="7"
   TIMEACTION="display"><BR>
  <IMG CLASS="mytime" SRC="slide5.gif" DUR="7"
   TIMEACTION="display">
  <IMG CLASS="mytime" SRC="slide6.gif" DUR="7"
   TIMEACTION="display">
</DIV>
</BODY>
</HTML>

Notice that because of the TIMECONAINER="seq" attribute, only one slide is displayed at a time. They all show up at the top left corner because of the attribute TIMEACTION="display" which forces a reflowing of the page each time an element disappears.

Sequencing a group of HTML elements can also be accomplished by the newly-created HTML+TIME element, t:SEQ. You have to define the t XML namespace in the HEAD section:

<XML:NAMESPACE PREFIX="t"/>

Try it now. You get the same results as above. Here is the full listing:

<HTML>
<HEAD>
  <XML:NAMESPACE PREFIX="t"/>
<TITLE>Simple HTML+TIME Example</TITLE>
<STYLE>
  .mytime {behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY>
<t:SEQ CLASS="mytime">
  <IMG CLASS="mytime" SRC="slide1.gif" DUR="5"
   TIMEACTION="display">
  <IMG CLASS="mytime" SRC="slide4.gif" DUR="5"
   TIMEACTION="display">
  <IMG CLASS="mytime" SRC="slide5.gif" DUR="5"
   TIMEACTION="display">
  <IMG CLASS="mytime" SRC="slide6.gif" DUR="5"
   TIMEACTION="display">
</t:SEQ>
</BODY>
</HTML>

You can use the TIMELINE attribute (instead of the TIMECONTAINER attribute) with the time behavior, as opposed to the time2 behavior. Remember, when using the time behavior, you have to prefix HTML+TIME attributes with "t:". The following example not only differs in using time instead of time2, it also does not use TIMEACTION="display". As a result, there is no reflowing of the page, and each slide appears in its original position, covering all four quadrants. Try it now. Here is the full listing:

<HTML>
<HEAD>
<STYLE>
  .mytime {behavior: url(#default#time);}
</STYLE>
</HEAD>
<DIV CLASS="mytime" t:TIMELINE="seq">
    <IMG SRC="slide1.gif" CLASS="mytime" t:DUR="2">
    <IMG SRC="slide4.gif" CLASS="mytime" t:DUR="2"><BR>
    <IMG SRC="slide5.gif" CLASS="mytime" t:DUR="2">
    <IMG SRC="slide6.gif" CLASS="mytime" t:DUR="2">
</DIV>
</BODY>
</HTML>

Next: How to play elements in parallel

http://www.internet.com


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: August 28, 2000
Revised: August 28, 2000

URL: http://www.webreference.com/js/column67/6.html