Hey, I'm a developer for another forum. We have limited access to our forums templates and the ftp server because our owner is M.I.A
I'm wondering if this code can be improved. I'm not an master coder or anything. And I don't have as much experience with jscript as I should lol.
What I did to make this code work is place a div inside a forum thread for my mods to edit and add member's stats.
the div looks like this:



Code:
<div id="rankings"> Username,2,2,4</div>
The first number is wins, the second is losses, the third is how many games have been played.


And here is the jscript:

Code:
function bubbleSort(a)
{
* * var swapped;
* * do {
* * * * swapped = false;
* * * * for (var i=0; i < a.length-1; i++) {
* * * * * * if (eval(a[i][5]) < eval(a[i+1][5])) {
* * * * * * * * var temp = a[i];
* * * * * * * * a[i] = a[i+1];
* * * * * * * * a[i+1] = temp;
* * * * * * * * swapped = true;
* * * * * * }
			if (eval(a[i][5]) == eval(a[i+1][5])) {
				if (eval(a[i][3]) > eval(a[i+1][3])) {
					var temp = a[i];
					a[i] = a[i+1];
					a[i+1] = temp;
					swapped = true;
* * * * * * }
* * * * * * }
* * * * }
* * } while (swapped);
}




function insertpodloga(){




document.getElementById('loading').style.display='none';




var myIFrame= document.getElementById('podloga').contentWindow.document.getElementById('rankings').innerHTML;
var lista=new Array();
var konacnalista= new Array();
lista= myIFrame.split("<br>");
var i=0;
for(i=0; i<lista.length-1;i++){
konacnalista.push(lista[i].split(","));
}




konacnalista.splice(0,1);




for(var j=0; j<konacnalista.length;j++){
konacnalista[j][3]=eval(konacnalista[j][1])+eval(konacnalista[j][2]);
var pts=eval(konacnalista[j][1])-eval(konacnalista[j][2]);
konacnalista[j][5]=pts;
if(pts<0){pts=0;}
konacnalista[j][4]=pts;
}
bubbleSort(konacnalista);




row=new Array();
cell=new Array();




row_num=konacnalista.length; //edit this value to suit
cell_num=6; //edit this value to suit




tab=document.createElement('table');
tab.setAttribute('id','rounded-corner');




tbo=document.createElement('tbody');




rownula_naslov0=document.createElement('tr');
rownula_naslov0.setAttribute('style', 'font-weight:bold; font-size:20px; text-align:center; color:white;');
cellnula0_naslov0=document.createElement('td');
contnula_naslov0=document.createTextNode("Table");
cellnula0_naslov0.setAttribute('colspan','6');
cellnula0_naslov0.setAttribute('style', 'background: #003568; color: #141414;');
cellnula0_naslov0.appendChild(contnula_naslov0);
rownula_naslov0.appendChild(cellnula0_naslov0);




rownula=document.createElement('tr');
rownula.setAttribute('style', 'font-weight:bold');




cellnula0=document.createElement('td');
contnula=document.createTextNode("NO.");
cellnula0.setAttribute('style', 'background: #003568; color: #141414;');
cellnula0.appendChild(contnula);
rownula.appendChild(cellnula0);




cellnula1=document.createElement('td');
contnula1=document.createTextNode("NAME");
cellnula1.setAttribute('style', 'background: #003568; color: #141414;');
cellnula1.appendChild(contnula1);
rownula.appendChild(cellnula1);




cellnula2=document.createElement('td');
contnula2=document.createTextNode("WON");
cellnula2.setAttribute('style', 'background: #003568; color: #141414;');
cellnula2.appendChild(contnula2);
rownula.appendChild(cellnula2);




cellnula3=document.createElement('td');
contnula3=document.createTextNode("LOST");
cellnula3.setAttribute('style', 'background: #003568; color: #141414;');
cellnula3.appendChild(contnula3);
rownula.appendChild(cellnula3);




cellnula4=document.createElement('td');
contnula4=document.createTextNode("PLAYED");
cellnula4.setAttribute('style', 'background: #003568; color: #141414;');
cellnula4.appendChild(contnula4);
rownula.appendChild(cellnula4);




cellnula5=document.createElement('td');
contnula5=document.createTextNode("PTS");
cellnula5.setAttribute('style', 'background: #003568; color: #FFFFFF;');
cellnula5.appendChild(contnula5);
rownula.appendChild(cellnula5);




tbo.appendChild(rownula_naslov0);
tbo.appendChild(rownula);




for(c=0;c<row_num;c++){
row[c]=document.createElement('tr');
cell[0]=document.createElement('td');
cont2=document.createTextNode(c+1);
cell[0].appendChild(cont2);
row[c].appendChild(cell[0]);
for(k=1;k<cell_num;k++) {
cell[k]=document.createElement('td');
cont=document.createTextNode(konacnalista[c][k-1]);
cell[k].appendChild(cont);
row[c].appendChild(cell[k]);
}
tbo.appendChild(row[c]);
}




tab.appendChild(tbo);
document.getElementById('mytable').appendChild(tab);
}
I anything needs to be known just ask.
I appreciate any help