复选框客户端实现全选和取消
//选中下拉列表ListBox中的全部
function SelectAllOption(SourceID)
{
var chkAll = document.getElementById("checkAll");
var Source = document.getElementById(SourceID);
var arrOption;
if( Source != null)
{
arrOption = Source.getElementsByTagName("option");
if(chkAll.checked == true)
{
for( var i=0;i<arrOption.length;i++)
{
arrOption.item(i).selected = "selected";
}
}
else
{
for( var i=0;i<arrOption.length;i++)
{
arrOption.item(i).selected = "";
}
}
}
}
//功能:Grid的复选框全部选择或全部取消
function CheckSelectAll()
{
var txtSeleteAll = document.all("txtSelectAll");
var intItemCount = gridFaultShow.rows.length;
var chk;
for(var i=1;i<intItemCount;i++)
{
chk = gridFaultShow.rows(i).cells(0).children(0);
if(chk != null)
{
chk.checked = event.srcElement.checked;//true
}
}
if(chk == null)
{
return;
}
if(chk.checked)
{
txtSeleteAll.innerText = "取消全选";
}
else
{
txtSeleteAll.innerText = "全部选择";
}
}
//功能:Grid的复选框全部取消选择
function CheckUnSelectAll()
{
var intItemCount = gridFaultShow.rows.length;
var chk;
for(var i=1;i<intItemCount;i++)
{
chk = gridFaultShow.rows(i).cells(0).children(0);
if(chk != null)
{
chk.checked = false;
}
}
}