//取得GridView物件var tbl = document.getElementById("<%= GridView_ID.ClientID %>");//取得Table物件//var tbl = document.getElementById("Table_ID");//for迴圈(GridView和Table的做法一樣)//i從1開始,因為title不用找for (i = 1; i < tbl.rows.length; i++) { //取得第一個cell裡的值 alert(tbl.rows[i].cells[0].innerHTML); //取得第三個cell裡面第一個TextBox or HiddenField的值 alert(tbl.rows[i].cells[2].childNodes[0].value);
//上面那行有問題tbl.rows[i].cells[2].getElementsByTagName("input")[0].value //取得第四個cell裡面第一個Label的值 alert(tbl.rows[i].cells[3].childNodes[0].innerText); //取得第五個cell裡面第一個DropDownList的值 tbl.rows[1].cells[5].children[1].value;}
沒有留言:
張貼留言