Reputation: 11
function Sort(td)
{
var t=document.getElementById("theList");
var rows=t.getElementsByTagName("td");
var cells=t.cells;
var bb=true;
while(bb==true)
{
alert(bb);
for(var i=1;i<rows.length;i++)
{
if(cells[td.cellIndex+i*4].innerText<cells[td.cellIndex+(i+1)*4].innerText)
{
}
}
alert("Works"); //this alert is not reached
}
}
The second alert will not be shown. Can you tell me why?
Upvotes: 1
Views: 141
Reputation: 31883
Your var rows
is an array, which will not have a property "cells". That could be your problem right there.
Upvotes: 2
Reputation: 23217
If something goes wrong in any of the code in the for loop it won't reach the second alert. I'd suggest running this in a JS debugger.
Upvotes: 0