代码:
<?php
include('conect.php');
$result = mysqli_query($conn,"SELECT * FROM `op` WHERE `type` = 2 ;");
echo "<table class='table table-striped table-hover'id='datatables-example'>
<tr>
<td class='pure-table'><b>Title 1</b></td>
<td class='pure-table'><b>Title 2</b></td>
<td class='pure-table'><b>Check 1</b></td>
<td class='pure-table'><b>Title 3</b></td>
<td class='pure-table'><b>VCheck 2</b></td>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tbody data-link='row' class='rowlink'>
<tr>
<td>' . $row['Op'] . '</td>
<td> <input type='text' name='T2' class='form-control'>
<td style='text-align:center;'> <input type='checkbox' name='C1' id='C1' >
<td> <input type='text' name='T3' id='T3' class='form-control' disabled >
<td style='text-align:center;'> <input type='checkbox' name='C2'>
</tr>
</tbody>
}
</table>";
mysqli_close($conn);
?>
<script language ="JavaScript">
document.getElementById('C1').onchange = function() {
document.getElementById('T3').disabled = !this.checked;
};
</script>
我想启用/禁用由输入数据的行数生成的多个文本框。
第一行工作正常但其他行没有。
我做错了什么?
答案 0 :(得分:0)
您的<td>
标记均未在第二行中关闭。