Suppose the current time is now 7000 milliseconds. When the time is 3000--6000, the value of 3000 is taken. When 6000--9000, the value of 6000 is taken, that is, the maximum value in xml that is less than the current time is taken
xml file,
2
Lecture 1< ;/title>
123
1.html
2
00 :00:30
1.html
3
Lecture 2
123
2.html
< ;orderNo>2
00:01:00
2.html
cd>
4
Lecture 3
123
3.html
2
00:01:30
3.html
javascript:
MediaPlayer.Controls.CurrentPosition * 1000 is the current time
function times() {
//Define array array
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 Secondss
x = xmlDom.getElementsByTagName("Secondss");
//Traverse
for (i =0; i < x.length; i) {
//Get the times attribute
var s = x[i].getAttribute("times");
//If the attribute value is less than MediaPlayer.Controls.CurrentPosition * 1000, add it to the array
if (s <= MediaPlayer.Controls. CurrentPosition *1000) {
array.push(s);
}
}
//Sort array At this time, array[array.length - 1] is smaller than MediaPlayer.Controls.CurrentPosition * 1000 The maximum value of
array.sort();
}