Сжать код большой html таблицы в функцию javascript, которая автоматически сгенерирует таблицу со значениями в коде. - PullRequest
0 голосов
/ 06 августа 2020
<table class="table>
<thead>
<tr class="row100 head">
    <th class="cell100 column1">Vertical Section</th>
    <th class="cell100 column2">Year</th>
    <th class="cell100 column4">File</th>
</tr>
</thead>
<tbody id="datatable">
<tr>
  <td class="cell100 column1">A01/AR07</td>
  <td class="cell100 column2">2000</td><td class="cell100 column4">
    <a href="http://joa.ucsd.edu/data_files/best/Atlantic_sections/A01_1991/File">File</a>

  </td>
</tr>
<tr>
  <td class="cell100 column1">A01/AR07</td>
  <td class="cell100 column2">2004</td>
  <td class="cell100 column4"><a href="http://joa.ucsd.edu/data_files/best/Atlantic_sections/A01_1991/File">File</a></td>
</tr>
<tr>
  <td class="cell100 column1">A01/AR07</td>
  <td class="cell100 column2">2009</td>
  <td class="cell100 column4"><a href="http://joa.ucsd.edu/data_files/best/Atlantic_sections/A01_1991/File">File</a></td>
</tr>
<tr>
  <td class="cell100 column1">A01/AR07</td>
  <td class="cell100 column2">WOA</td>
  <td class="cell100 column4"><a href="http://joa.ucsd.edu/data_files/best/Atlantic_sections/A01_1991/File">File</a></td>
</tr>


<tr>
<td class="cell100 column1">A01E/AR07E</td>
<td class="cell100 column2">1990</td>
<td class="cell100 column4"><a href="http://joa.ucsd.edu/data_files/best/Atlantic_sections/A01_1991/File">File</a></td>
</tr>
<tr>
<td class="cell100 column1">A01E/AR07E</td>
<td class="cell100 column2">1991</td>
<td class="cell100 column4"><a href="http://joa.ucsd.edu/data_files/best/Atlantic_sections/A01_1991/File">File</a></td>
</tr>
<tr>
<td class="cell100 column1">A01E/AR07E</td>
<td class="cell100 column2">2001</td>
<td class="cell100 column4"><a href="http://joa.ucsd.edu/data_files/best/Atlantic_sections/A01_1991/File">File</a></td>
</tr>
</tbody
</table>

Как я могу преобразовать всю эту таблицу в функцию Javascript, которая автоматически сгенерирует таблицу. Может быть, я могу просто передать где-нибудь значения в какую-нибудь переменную. Я не понимаю, пожалуйста, помогите. Мне еще нужно добавить сотню строк на сайт stati c. Следовательно, я не могу использовать SQL.

...