var Table=...;
var prior=[2,4,7,1,...];//比较优先级
function compare(a,b){
  for(var i=0;i<prior.length;i++)
    if(a[prior[i]]!=b[prior[i]])
      return a[prior[i]]<b[prior[i]]?-1:1;//这是升序,降序相反
  return 0;//a和b相等
}
Table.sort(compare);

解决方案 »

  1.   

    按照你的需求写的模拟程序
    <script language=javascript>
    var myArray = new Array()
    for(var i=0;i<10;i++)
    {
    myArray[i]=new Array();
    myArray[i][0]=Math.floor(Math.random()*10);
    myArray[i][1]=Math.floor(Math.random()*10);
    myArray[i][2]=Math.floor(Math.random()*10);
    myArray[i][3]=Math.floor(Math.random()*10);
    myArray[i][4]=Math.floor(Math.random()*10);
    myArray[i][5]=Math.floor(Math.random()*10);
    myArray[i][6]=Math.floor(Math.random()*10);
    myArray[i][7]=Math.floor(Math.random()*10);
    myArray[i][8]=Math.floor(Math.random()*10);
    }
    myArray.sort( function(x, y) {
    return (x[2]==y[2])?((x[4]==y[4])?(x[8]-y[8]):(x[4]-y[4])):(x[2]-y[2])
                                 }
                );
    for(var i=0;i<myArray.length;i++)
    {
    document.write(myArray[i].join(",")+"<br>")
    }
    </script>