我在网上搜索过,我找不到答案,所以我要问这个问题.
新数据将始终格式化如下,并将填入id ="content"
<tr>
<td>name</td>
<td>age</td>
<td>gender</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我看了你需要有<div>内部的<td>,如果你打算把<div>里面<table>.现在,格式不正确.所有新数据都在第一列,而不是每行中的每一个.
<table>
<tr>
<th>name</th>
<th>age</th>
<th>gender</th>
</tr>
<td>
<div id="contents">
<tr>
<td>John</td>
<td>12</td>
<td>male</td>
</tr>
<tr>
<td>Jess</td>
<td>13</td>
<td>female</td>
</tr>
</div>
<td>
</table>
Run Code Online (Sandbox Code Playgroud)
更新
重读你最有可能需要的结构
<table>
<thead>
<tr>
<th>name</th>
<th>age</th>
<th>gender</th>
</tr>
</thead>
<tbody id="contents">
<tr>
<td>John</td>
<td>12</td>
<td>male</td>
</tr>
<tr>
<td>Jess</td>
<td>13</td>
<td>female</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
原始答案
你不能拥有tr直接的孩子div.
你需要使用一个表
或
<table>
<tr>
<th>name</th>
<th>age</th>
<th>gender</th>
</tr>
<td>
<table id="contents">
<tr>
<td>John</td>
<td>12</td>
<td>male</td>
</tr>
<tr>
<td>Jess</td>
<td>13</td>
<td>female</td>
</tr>
</table>
<td>
</table>
Run Code Online (Sandbox Code Playgroud)
要么
<table>
<tr>
<th>name</th>
<th>age</th>
<th>gender</th>
</tr>
<td>
<div id="contents">
<table>
<tr>
<td>John</td>
<td>12</td>
<td>male</td>
</tr>
<tr>
<td>Jess</td>
<td>13</td>
<td>female</td>
</tr>
</table>
</div>
<td>
</table>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2674 次 |
| 最近记录: |