Compartilhar via


item Method

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

Retrieves an object from the specified collection by index.

Syntax

oItem = activeElements.item( [iIndex])

Parameters

iIndex Optional. An Integer that specifies the index or name of the object to retrieve from the collection. The first object in the collection is located at index position 0, and the last object in the collection is located at position length minus 1. If a value is not specified, the default is 0.

Return Value

Returns a reference to the object located at the specified index in the collection.

Example

This example demonstrates how to use the item method to retrieve an object from a collection.

<HTML XMLNS:t="urn:schemas-microsoft-com:time">
<HEAD>
<TITLE>item Method</TITLE>
<?IMPORT namespace="t" implementation="#default#time2">

<STYLE>
    .time{ behavior: url(#default#time2);}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
var m2; //another media object
//...
function setActiveTrack(){
    if(itemNumber.value=="" || 
            (itemNumber.value<1 || itemNumber.value>5) || 
            (isFinite(itemNumber.value)==false)){
        alert('Must enter a valid track number!\nPlease re-enter your choice (1-5).');
        itemNumber.value='';
        itemNumber.focus();
        return;
    }else{
        m2 = m1.playList.item(itemNumber.value-1); //index starts at 0
        updateFields();
    }
}
...
</SCRIPT>
</HEAD>

<BODY>

<t:media id="m1" begin="indefinite;" 
   src="/workshop/samples/author/behaviors/media/media.asx" />

<span id="title1">Title:</span><BR>
<span id="author1">Author:</span><BR>
<span id="abstract1">Abstract:</span><BR>
<span id="copyright1">Copyright:</span><BR>
<span id="index1">Index: </span><BR><BR>

Enter track number (1-5): <input type="text" name="itemNumber" value="" size="2"><BR><BR>

<BUTTON id="b0" onclick="m1.beginElement();setActiveTrack();">Start</BUTTON>
<BUTTON id="b3" onclick="m1.endElement();emptyFields();">Stop</BUTTON>
<BR><BR>

</BODY>
</HTML>

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

Applies To

activeElements

See Also

Introduction to HTML+TIME, item