数组排序与下标
<script>
var c= new Array();
var orderdata = [12,43,5,96];
var orderLength = orderdata.length;
var temp,tp;
for(var l =0;l<orderLength ;l++) c[l]=l;
for (var i=0;i<orderLength ;i++)
{
for (var j = 0; j < orderLength - i-1; j++)
{
if(orderdata[j] > orderdata[j+1])
{
temp = orderdata[j];
orderdata[j] = orderdata[j+ 1];
orderdata[j + 1] = temp;
tp = c [j];
c[j] = c[j+1];
c[j+1] = tp;
}
}
}
for(var m=0;m<orderLength;m++)
document.write(c[m]+" ");
</script>