var
i,c,
list = document.getElementById('test-list');
c = list.children;
for (i=1;i<list.children.length;i++){
for(j=0;j<=i;j++){
if(c[i].innerText.slice(0,1)<c[j].innerText.slice(0,1)){
list.insertBefore(c[i],c[j]);
}
Sign in to make a reply
一年改一次请谨慎提交
var
i,c,
list = document.getElementById('test-list');
c = list.children;
for (i=1;i<list.children.length;i++){
for(j=0;j<=i;j++){
if(c[i].innerText.slice(0,1)<c[j].innerText.slice(0,1)){
list.insertBefore(c[i],c[j]);
}
}
}