用javascript怎麼table中button行和列的index

解决方案 »

  1.   

    如一個gridView里放個button,我點擊button的時候,怎麼用javascript得到行和列的index
      

  2.   

    <input type="button" onclick="getIndex(this)"/>var getIndex=function(obj) {
    var td=obj.parentNode;
    alert("列:"+td.cellIndex);//索引从0开始
    alert("行:"+td.parentNode.rowIndex);
    }
      

  3.   

    如果這個gridview里的rows[1].cells[0]里還有一個table,我要怎麼得到這個table的值