Suppose the current time is now 7000 milliseconds. When the time is 3000--6000 is to go 3000 value, when 6000--9000, take 6000 of the value, that is, the maximum value of the XML is less than the current time
XML file,
Copy Code code as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<catalog>
<cd>
<ID>2</ID>
<title> 1th Lecture </title>
<mediaUrl>123</mediaUrl>
<orderNo>2</orderNo>
<StudyTimes>00:00:30</StudyTimes>
<secondss times= "30000" >1.html</Secondss>
</cd>
<cd>
<ID>3</ID>
<title> 2nd Lecture </title>
<mediaUrl>123</mediaUrl>
<orderNo>2</orderNo>
<StudyTimes>00:01:00</StudyTimes>
<secondss times= "60000" >2.html</Secondss>
</cd>
<cd>
<ID>4</ID>
<title> 3rd Lecture </title>
<mediaUrl>123</mediaUrl>
<orderNo>2</orderNo>
<StudyTimes>00:01:30</StudyTimes>
<secondss times= "90000" >3.html</Secondss>
</cd>
</catalog>
Javascript:
MediaPlayer.Controls.CurrentPosition * 1000 for current time
Copy Code code as follows:
Function times () {
Defining array Arrays
var array =new array ();
Define XMLDOM protocol
var xmldom =new ActiveXObject ("Microsoft.XMLDOM");
Xmldom.async =false;
Load XML file
Xmldom.load (Id.value + "_imsmanifest.xml"); Jump
try {
Find all the SECONDSS.
x = Xmldom.getelementsbytagname ("Secondss");
Traverse
for (I =0 < x.length; i++) {
Fetch Times Property
var s = X[i].getattribute ("Times");
Add to array if property value is less than MediaPlayer.Controls.CurrentPosition * 1000
if (s <= MediaPlayer.Controls.CurrentPosition *1000) {
Array.push (s);
}
}
Sort array at this time array[array.length-1] is less than the maximum value of MediaPlayer.Controls.CurrentPosition * 1000
Array.Sort ();
}