<script language="javascript">
function setcheckboxes(str)
{
var ischecked = document.form4.boxname.checked;
var element = document.getElementsByName(str);
var num = (typeof(element.length) != 'undefined') ? element.length : 0;
if (num)
{
for (var i = 0; i < num; i++)
{
element[i].checked = ischecked;
}
}
else
{
element.checked = ischecked;
}
document.getElementsByName('boxname').checked=ischecked;
}
</script>
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<form action="" method="POST" name="form4">
<td colspan="7" style="text-align:left;"><input type="checkbox" name="boxname" id="boxname" onclick="setcheckboxes('checkent[]')" value="aa1" style="margin:0 0 0 0.7%" />
<label for="aa1">全选/取消</label></td>
</tr>
</form>
function setcheckboxes(str)
{
var ischecked = document.form4.boxname.checked;
var element = document.getElementsByName(str);
var num = (typeof(element.length) != 'undefined') ? element.length : 0;
if (num)
{
for (var i = 0; i < num; i++)
{
element[i].checked = ischecked;
}
}
else
{
element.checked = ischecked;
}
document.getElementsByName('boxname').checked=ischecked;
}
</script>
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<tr align=left> <td class="ck"><input name="checkent[]" type="checkbox" value="%s" />
<form action="" method="POST" name="form4">
<td colspan="7" style="text-align:left;"><input type="checkbox" name="boxname" id="boxname" onclick="setcheckboxes('checkent[]')" value="aa1" style="margin:0 0 0 0.7%" />
<label for="aa1">全选/取消</label></td>
</tr>
</form>
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/641/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2007-8-29 16:45
评论列表