Hope someone can help. I have created multiple arrays in JS as follows;
var tOne= new Array(0,"team one"); var tTwo= new Array(0,"team two"); var tThree= new Array(0,"team three");
I then have a function that gives the first element in the array a number ranking.
I want to create a table that ranks teams by the highest rank at the top.
To do this I want to rank by the first element in the array..
function sortNumber(a,B)
{
return a - b;
}
var n = [tOne[0],tOne[0],tOne[0]];
document.write(n.sort(sortNumber));
which seems to work.. however, I need a way to specify which team gets which rank. To give it an ID in effect.
Does anyone have any ideas?
This post has been edited by Tarsus: 22 January 2012 - 12:44 PM

New Topic/Question
Reply



MultiQuote



|