【发布时间】:2013-05-18 21:35:24
【问题描述】:
当一个主要的可见复选框被选中时,我需要自动选中或取消选中两个隐藏的复选框。 三个复选框在一个while循环内。
让我解释一下,这是我的表格:
<form action="updateAuc.php" method="POST" name="edit">
<div class="editbutton">
<ul>
<li class="leditcnt"><input class="submitbutton" type="submit" name="edit" value="Aggiorna Trasferimenti" /></li>
<li class="lremove"><a href="auctionfree_list.php"><input name="Button" type="button" class="linkbutton" value="Annulla" /></a></li>
</ul>
</div>
<table width = "100%">
<tr class="title">
<td class="head">Player</td>
<td class="head">Action</td>
<td class="head">Win</td>
</tr>
<?php do { ?>
<tr>
<td class="table1"><?php echo $row_dataauc['playerName']; ?></td>
<td class="table1"><?php echo $row_dataauc['amount']; ?> - <?php echo $row_dataauc['teambid']; ?></td>
<td class="table1">
<input name="enable[]" class="inputfield" type="checkbox" value="<?php echo $row_dataauc['aucid']?>"/>
<input name="enable2[]" class="inputfield" style="display:none" type="checkbox" value="<?php echo $row_dataauc['id']?>"/>
<input name="enable3[]" class="inputfield" style="display:none" type="checkbox" value="<?php echo $row_dataauc['coachID']?>"/>
</td>
</tr>
<?php } while ($row_dataauc = mysqli_fetch_assoc($dataauc)); ?>
</table>
</form>
name="enable[]" 是主要的;当我检查这个时,name=”enable2[]”和name”enable3[]”也必须自动检查。
【问题讨论】:
-
欢迎来到 StackOverflow。请阅读stackoverflow.com/faq 的常见问题解答。通常的问题是:“你尝试过什么?”。我们在这里帮助解决编程问题,而不是为您编写代码。我建议你编辑你的问题。
标签: php javascript checkbox