jiangqr

#1 Created at ... [Delete] [Delete and Lock User]

// sort list: var i,j, c =[], list = document.getElementById('test-list'), length = list.children.length;

for (i = 0; i < length; i++) { c[i] = list.children[i].innerText; }

for(i = 0; i < length; i++){

var iText = c[i];
for(j = i+1; j < length; j++){

    var jText = c[j];
    if( iText > jText){
        list.insertBefore(list.children[j], list.children[i]);
    }
}

}


  • 1

Reply