日期:2014-05-16  浏览次数:20331 次

javascript 获取表格中td的值
function fetchTdValue(tableId){
				var table = document.getElementById(tableId);
				var trLength = table.rows.length;
				var tdLength = 0;
				var tr;
				var td;
				var tdValue = "";
				if(trLength){
						for(var i = 1;i<trLength;i++){
								tr = table.rows[i];
								tdLength = tr.cells.length;
								if(tdLength){
									for (var j=2;j<tdLength;j++){
										td = tr.cells[j];
										tdValue = tdValue + td.innerHTML+";";
									}
								}
								tdValue = tdValue +"@@@";
							}
					}
				return tdValue;
		}