开发者

While doesn't work

开发者 https://www.devze.com 2022-12-30 13:11 出处:网络
function Sort(td) { var t=document.getElementById(\"theList\"); var rows=t.getElementsByTagName(\"td\");
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.

0

精彩评论

暂无评论...
验证码 换一张
取 消