脚本宝典收集整理的这篇文章主要介绍了php – 选择所有复选框,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<form action="noJavaScript.PHP" name="theForm" method="post"> <table style="border: 1px solid black" RULES=ALL FRAME=VSIDES> <th> </th><th>Order #</th><th>InsPEctor</th><th>Reference #</th><th>Client Name</th><th>PRoperty Address</th><th>CITy</th><th>state</th><th>Zip</th><th>inspection Date</th> <?PHP while ($row = MysqL_fetch_assoc($result)) { echo '<tr><td>'; echo '<input type="checkBox" name="selected[]" value="'.$row['order_number'].'"/>'; echo '</td>'; foreach ($row as $key => $value) echo '<td>'.htMLspecialchars($value).'</td>'; echo '</tr>'; } ?> </table> <input type="submit" name="submit" value="Edit/Modify Order" onClick="document.theForm.action='modify.PHP'"> <input type="submit" name="submit" value="Clone Order" onClick="document.theForm.action='clone.PHP'"> <input type="submit" name="submit" value="Delete Order" onClick="document.theForm.action='deleteorder.PHP'"> <input type="submit" name="submit" value="Archive Order" onClick="document.theForm.action='archive.PHP'"> </form>
我试过使用以下功能:
<script type="text/javascript" <!-- function SetAllCheckBoxes(FormName,FieldName,CheckValue) { if(!document.forms[FormName]) return; VAR objCheckBoxes = document.forms[FormName].elements[FieldName]; if(!objCheckBoxes) return; var countCheckBoxes = objCheckBoxes.length; if(!countCheckBoxes) objCheckBoxes.checked = CheckValue; else // set the check value for all check Boxes for(var i = 0; i < countCheckBoxes; i++) objCheckBoxes[i].checked = CheckValue; } // --> </script>
这样的按钮:
<input type="button" onclick="SetAllCheckBoxes('theForm','myCheckBox',true);" value="Check All">;
但我无法让它发挥作用.
以上是脚本宝典为你收集整理的php – 选择所有复选框全部内容,希望文章能够帮你解决php – 选择所有复选框所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。