Sorting an HTML select list...

If you're looking for a sort function for HTML -- you might try this:
function sortLst(lst,start)                                   
{ var unsorted;                                             
  var hold;                                                 
  unsorted=true;                                            
  while (unsorted==true)                                    
  { unsorted=false;                                       
    for (i=start;i<lst.length - 1;i++ )                   
    { if (lst.options[i].text>=lst.options[i+1].text)   
      { hold=lst.options[i].text;                     
        lst.options[i].text=lst.options[i+1].text;    
        lst.options[i+1].text=hold;                   
        unsorted=true;                                
      }                                                 
    }                                                     
  }                                                         
}                                                             

SAMPLE USE

No comments:

Favorite Tweets