activeTrack参数属性 | DHTML中文手册 |
Sets or retrieves the track, or playitem object, that is currently active in the playlist collection.
dhtml语法
playlist.activetrack [ = oplayitem ]
dhtml可能的值
oPlayItem Object that specifies or receives the name of the track, or playItem object, that is currently active in the playList collection. The property is read/write. The property has no default value.
Remarks
Using this property to set the active track in the playList causes that track to begin playing immediately.
If a script accesses this property on a playList that is not currently active, an error is returned. To prevent this error, the script should check the element's isactive property before attempting to read the activetrack.
DHTML代码范例
This example demonstrates how to retrieve a property of the currently active track using the activeTrack property.
<HTML XMLNS:t="urn:schemas-microsoft-com:time"> <HEAD> <?IMPORT namespace="t" implementation="#default#time2"> <TITLE>HTML+TIME playList Example</TITLE> <LINK REL="stylesheet" href="../../common/samples/samples.css" type="text/css"> <STYLE> .time{ behavior: url(#default#time2);} </STYLE> <SCRIPT LANGUAGE="JScript"> function updateBtns() { if (oMedia.currTimeState.isActive) { btnStart.disabled=true; btnNext.disabled=false; btnPrev.disabled=false; btnStop.disabled=false; } else { btnStart.disabled=false; btnNext.disabled=true; btnPrev.disabled=true; btnStop.disabled=true; } } function updateFields() { oTitle.innerText = "Title: " + oMedia.playList.activeTrack.title; oAuthor.innerText = "Author: " + oMedia.playList.activeTrack.author; oAbstract.innerText = "Abstract: " + oMedia.playList.activeTrack.abstract; oCopyright.innerText = "Copyright: " + oMedia.playList.activeTrack.copyright; oFilename.innerText = "Filename: " + oMedia.playList.activeTrack.src; } function clearFields() { oTitle.innerText = "Title: "; oAuthor.innerText = "Author: "; oAbstract.innerText = "Abstract: "; oCopyright.innerText = "Copyright: "; oFilename.innerText = "Filename: "; } </SCRIPT> </HEAD> <BODY onload="updateBtns()"> <t:MEDIA id="oMedia" src="short_3tracks.asx" begin="indefinite" timeAction="visibility" onend="updateBtns();" ontrackchange="updateFields();"/> <P> <SPAN id="oTitle">Title:</SPAN><BR> <SPAN id="oAuthor">Author:</SPAN><BR> <SPAN id="oAbstract">Abstract:</SPAN><BR> <SPAN id="oCopyright">Copyright:</SPAN><BR> <SPAN id="oFilename">Filename:</SPAN><BR><BR> <BUTTON id="btnStart" onclick="oMedia.beginElement(); updateBtns();"> Start </BUTTON> <BUTTON id="btnPrev" onclick="oMedia.playList.prevTrack();"> Previous Track </BUTTON> <BUTTON id="btnNext" onclick="oMedia.playList.nextTrack();"> Next Track </BUTTON> <BUTTON id="btnStop" onclick="oMedia.endElement(); clearFields();"> Stop </BUTTON> </BODY> </HTML>
是否符合公共标准
This property is a Microsoft extension to Synchronized Multimedia Integration Language (SMIL) .
Applies To
playList
更多语法参考
introduction to html+time, nexttrack, prevTrack