While doesn't work
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<开发者_Python百科;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?
Your var rows
is an array, which will not have a property "cells". That could be your problem right there.
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.
精彩评论