javascriptt遍歷Table

<script>

function MyTableValue()

{

  var table=document.getElementById("MyTable");

  var rows=table.rows.length;

  var columns=table.rows[0].cells.length;

  

  for(var RowCount=0;RowCount<rows;RowCount++)

  {

  		for(var cellCount=0;cellCount<columns;cellCount++)

		{

		   if(table.rows[RowCount].cells[cellCount].innerText=="SHE")

		   {

		       alert(RowCount+1+"行"+(cellCount+1)+"列");

		   }

		}	

  }

     

}

</script>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章