javascript写的表格,如何选定行。

解决方案 »

  1.   

    你要什么效果啊?和html表格相同的
      

  2.   

    用DOM比较方便
    var oCell=document.createElement("TD");
    oCell.onclick=function (){
      //.......
    }
    oCell.onmouseover=function (){
      //..................
    }用innerHTML不太好控制
      

  3.   

    设定全局变量currow
    function selectrow(theObject){
        currow=theObject.parentElement.rowIndex;
        alert(currow);
    }每添加一行后(也就是col = row.insertCell(0);之后)加下面这句话
    col.onclick=selectrow(this);