HBCMS更多的中文手册参考:

activeElements Collection

DHTML中文手册

Returns a reference to the collection of all top-level child elements of the object that are currently active on the timeline.

dhtml语法

[ oColl = ] object.activeElements
[ oObject = ] object.activeElements(iIndex)

DHTML可能的值

oCollArray of elements contained by the object.
oObjectReference to an individual item in the array of elements contained by the object.
iIndexRequired. Integer that specifies the zero-based index of the item to be returned.

Members Table

PropertyDescription
length Retrieves the number of objects in a collection.
MethodDescription
item Retrieves an object from the specified collection.

Remarks

The body element behaves like a t:par element, or parallel time container. therefore, you can retrieve all the currently active top-level elements in the document by applying the activeelements collection to the body element.

as with other dynamic html(动态html,即dhtml) collections, you can use an index value to access objects contained in the activeelements collection. however, you might encounter scripting errors, because the contents of this collection can change quickly as local timelines expire in the document. typically, these errors occur when using an index value that becomes invalid because a timeline ends and the collection contains fewer objects. to prevent these errors, avoid stepping through each object in the collection that uses a for loop that starts at index 0 and then processes each element until it reaches the last index. instead, use the enumerator object in microsoft?jscript? or the for each...next statement in microsoft visual basic?scripting edition (vbscript).

DHTML代码范例

The following example shows how to access each member of the activeElements collection.

<HTML>
<HEAD>
<TITLE>activeElements Collection</TITLE>
<STYLE>
.time {behavior:url(#default#time2);}
</STYLE>
<XML:NAMESPACE PREFIX="t"/>
<SCRIPT LANGUAGE="JScript">
function showActive() {
var oAE = new Enumerator(parallel.activeElements);
var myStr = "";
for(; !oAE.atEnd(); oAE.moveNext()) {
myStr = myStr + "\nElement Type: <" + oAE.item().tagName +
">; Element ID: " + oAE.item().id;
}
alert("Currently Active Elements: " + myStr);
}
</SCRIPT>
</HEAD>
<BODY ID="docBody">
<P>Click the button below to display the elements that are
currently active on the timeline. In this sample, active elements
are displayed in color while they are active. Elements that are
inactive are displayed in black.
</P>
<BUTTON STYLE="width:140px;" onclick="showActive();">Show Active
Elements</BUTTON>
<t:PAR CLASS="time" ID="parallel" timeaction="none" DUR="9"
REPEATCOUNT="indefinite">
<H1 ID="hdg1" CLASS="time" STYLE="color:red;"
TIMEACTION="style" BEGIN="0" DUR="3">Heading 1</H1>
<H2 ID="hdg2" CLASS="time" STYLE="color:red;"
TIMEACTION="style" BEGIN="0" DUR="3">Heading 2</H2>
<H3 ID="hdg3" CLASS="time" STYLE="color:blue;"
TIMEACTION="style" BEGIN="3" DUR="3">Heading 3</H3>
<H4 ID="hdg4" CLASS="time" STYLE="color:blue;"
TIMEACTION="style" BEGIN="3" DUR="3">Heading 4</H4>
<H5 ID="hdg5" CLASS="time" STYLE="color:green;"
TIMEACTION="style" BEGIN="6" DUR="3">Heading 5</H5>
<H6 ID="hdg6" CLASS="time" STYLE="color:green;"
TIMEACTION="style" BEGIN="6" DUR="3">Heading 6</H6>
</t:PAR>
</BODY>
</HTML>
This feature requires Microsoft?Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

是否符合公共标准

This collection is a Microsoft extension to Synchronized Multimedia Integration Language (SMIL) Non-Microsoft link.

Applies To

t:EXCL, t:PAR, t:SEQ

更多语法参考

introduction to html+time, timeall, timeChildren