高分求教:用JS 把DataGrid的某列数据取出.急
我现在就是要用JS 把DataGrid的某列数据取出来 做循环
我怎么取??????????
谢谢
------解决方案--------------------var tb = document.getElementById( "DataGrid1 ");
var str = " ";
for(var i=1;i <tb.rows.length;i++)
{
str += tb.rows[i].cells[0].innerText + ", ";
}
alert(str);
------解决方案--------------------var table = document.getElementById( "DataGrid1 ");
var cTR = table.getElementsByTagName( "TR ");
for (i = 0; i < cTR.length; i++)
{
var tr = cTR.item(i);
var str = tr.cells[0].innerText
}
------解决方案--------------------如一楼
var tb = document.getElementById( "DataGrid1 ");
var str = " ";
//如果你的datagrid有页脚i <tb.rows.length-1
for(var i=1;i <tb.rows.length;i++)
{
str += tb.rows[i].cells[0].innerText + ", ";
}
alert(str);