0
我需要JavaScript代码的帮助来动态添加行和列,并显示行和列号。动态。添加行和列以打开并显示行和列号
<!DOCTYPE html>
<html>
<head>
<style>
table, td {
border:1px solid black;
}
</style>
</head>
<body>
<p>Click on each tr element to alert its index position in the table:</p>
<table>
<tr onclick="myFunction(this)">
<td>Click to show rowIndex</td>
</tr>
<tr onclick="myFunction(this)">
<td>Click to show rowIndex</td>
</tr>
<tr onclick="myFunction(this)">
<td>Click to show rowIndex</td>
</tr>
</table>
<script>
function myFunction(x) {
alert("Row index is: " + x.rowIndex);
}
</script>
</body>
这是我已经试过,但我不知道是否该表格的行和列是动态生成的,也列不renerated和显示。 请帮忙。
发布您尝试的代码。 –