Показать сообщение отдельно
  #5 (permalink)  
Старый 04.11.2019, 13:34
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,072

обход ячеек таблицы сверху на вниз
DDim1000,
<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">


</head>

<body>
<table width="400" class="MyTab" >
	<thead>
		<tr>
			<th>Title 1</th>
			<th>Title 2</th>
			<th>Title 3</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>Cell 1.1</td>
			<td>Cell 1.2</td>
			<td>Cell 1.3</td>
		</tr>
		<tr>
			<td>Cell 2.1</td>
			<td>Cell 2.2</td>
			<td>Cell 2.3</td>
		</tr>
	</tbody>
</table>
<script>
var tch = document.querySelectorAll(".MyTab tbody tr");
    tch[0].querySelectorAll('td').forEach(function(_, i) {
    tch.forEach(function(tr) {
    alert(tr.cells[i].textContent)
      });
    });
  </script>
</body>
</html>
Ответить с цитированием