to:woyingjie,请教另一个功能
woyingjie大虾,我上面漏了一个功能,就是你如果手工把小的chenkbox全部选满,然后下面全选的框勾给划上,这功能代码怎么加在里面?
<input name="all" type="checkbox" onclick="baoall()"><font size="2">全选</font><br>
<input name="m" type="checkbox" onclick=woyingjie()>
<input name="m" type="checkbox" onclick=woyingjie()>
<input name="m" type="checkbox" onclick=woyingjie()>
<input name="m" type="checkbox" onclick=woyingjie()>
<input name="m" type="checkbox" onclick=woyingjie()>
<input name="m" type="checkbox" onclick=woyingjie()>
<script language="javascript">
function baoall(){
var all=document.all.all.checked;
var inputs=document.getElementsByTagName("INPUT");
for (var i=0;i<inputs.length;i++){
if (inputs[i].type=="checkbox" && all==true){
inputs[i].checked=true;
inputs[i].style.background="black"
}else{
inputs[i].checked=false;
inputs[i].style.background=""
}
}
}
function woyingjie(){
document.all.all.checked=false;
}
</script>
问题点数:0、回复次数:2Top
1 楼woyingjie(Hobo)回复于 2004-09-04 16:29:09 得分 0
<input name="all" type="checkbox" onclick="baoall()"><font size="2">全选</font><br>
<input name="m" type="checkbox" onclick=woyingjie()>
<input name="m" type="checkbox" onclick=woyingjie()>
<input name="m" type="checkbox" onclick=woyingjie()>
<input name="m" type="checkbox" onclick=woyingjie()>
<input name="m" type="checkbox" onclick=woyingjie()>
<input name="m" type="checkbox" onclick=woyingjie()>
<script language="javascript">
function baoall(){
var all=document.all.all.checked;
var inputs=document.all.m;
for (var i=0;i<inputs.length;i++){
if (all==true){
inputs[i].checked=true;
inputs[i].style.background="black"
}else{
inputs[i].checked=false;
inputs[i].style.background=""
}
}
}
function woyingjie(){
var hoho=document.all.m
for (var i=0;i<hoho.length;i++){
if (!hoho[i].checked){
document.all.all.checked=false;
return false;
}
}
document.all.all.checked=true;
return true;
}
</script>Top
2 楼w78z007()回复于 2004-09-04 17:10:00 得分 0
但是我的check是循环显示的,也就是说name不是m而是一个数组。
我是这样的:while($data=mysql_fetch_array($result))
printf("<td><input type='checkbox' name='select_id[]'></td>",$data[id])
但我用select_id[]替换m说缺少对象?Top




