javascript multibox 全选
程序员文章站
2022-07-11 18:14:57
复制代码 代码如下:function allselect() { try{ var checkedcount=0; for(var i=0;i
function allselect()
{
try{
var checkedcount=0;
for(var i=0;i<form1.orgids.length;i++)
{
if(form1.orgids[i].checked)
checkedcount++;
}
if(checkedcount==form1.orgids.length)
{
for(var i=0;i<form1.orgids.length;i++)
{
form1.orgids[i].checked=false;
}
}
else
{
for(var i=0;i<form1.orgids.length;i++)
{
form1.orgids[i].checked=true;
}
}
if(form1.orgids.checked==true)
form1.orgids.checked=false;
else
form1.orgids.checked=true;
}catch(ex){}
}
<span style="cursor:hand" onclick="allselect()">(全选)</span>
<logic:iterate id="result" name="zclist" indexid="ind">
<html:multibox property="orgids"><bean:write name="result" property="someproperty"/></html:multibox>
</logic:iterate>
复制代码 代码如下:
function allselect()
{
try{
var checkedcount=0;
for(var i=0;i<form1.orgids.length;i++)
{
if(form1.orgids[i].checked)
checkedcount++;
}
if(checkedcount==form1.orgids.length)
{
for(var i=0;i<form1.orgids.length;i++)
{
form1.orgids[i].checked=false;
}
}
else
{
for(var i=0;i<form1.orgids.length;i++)
{
form1.orgids[i].checked=true;
}
}
if(form1.orgids.checked==true)
form1.orgids.checked=false;
else
form1.orgids.checked=true;
}catch(ex){}
}
复制代码 代码如下:
<span style="cursor:hand" onclick="allselect()">(全选)</span>
<logic:iterate id="result" name="zclist" indexid="ind">
<html:multibox property="orgids"><bean:write name="result" property="someproperty"/></html:multibox>
</logic:iterate>
下一篇: 腹胀是怎么回事,你们知道吗