这是对两个并行节点列表进行排序的冒泡排序的一部分,payRates并且txlis.
for(var index=0; index < payRates.length; index++){
if(payRates[index] < payRates[index+1]){
var temp = payRates[index];
payRates[index] = payRates[index+1];
payRates[index+1] = temp;
temp = txlis[index];
txlis[index] = txlis[index+1];
txlis[index+1] = temp;
bubbled = true;
}
payRates是浮点对象的 NodeList。txlis是一个 LI 元素的 NodeList。我可以覆盖其中的元素,payRates但无论我尝试什么,其中的元素都txlis保持原来的顺序。
我已经像这个例子一样尝试过,我已经尝试过list.parentNode.replaceChild()(listUL 元素是从哪里txlis派生的),我已经尝试从头开始创建新的 LI 元素,但没有任何效果。
我究竟做错了什么?