for(var p=0; p<(list.childNodes.length-1);p++){
x=list.childNodes[p].childNodes[4].innerHTML;
y=list.childNodes[p+1].childNodes[4].innerHTML;
c=list.childNodes[p];
// console.log(c)
var x1=x.split(":")[0];
var x2=x.split(":")[1];
var y1=y.split(":")[0];
var y2=y.split(":")[1];
if(Number(x1)>Number(y1)||(Number(x1)==Number(y1)&&Number(x2)>Number(y2))){
shouldSwitch = true;
break;
}
}
测试时
一直出现以下错误
Uncaught TypeError: Cannot read property 'innerHTML' of undefined
at Object.success (tra.js:354)
at fire (jquery-1.12.4.js:3232)
at Object.fireWith [as resolveWith] (jquery-1.12.4.js:3362)
at done (jquery-1.12.4.js:9840)
at XMLHttpRequest.callback (jquery-1.12.4.js:10311)
这该怎么解决