GridView等中全选CheckBox
//table:Gridview或Table的ClientID,columnIndex:CheckBox所在列的索引号
function selectGridViewAllCheckBox(gvID,columnIndex)
{
var _this=document.getElementById(gvID);
for(var i=1;i<_this.rows.length;i++)
{
if(typeof(_this.rows[i].cells[columnIndex])=="object")
{
for(var j=0;j<_this.rows[i].cells[columnIndex].childNodes.length;j++)
{
var oj=_this.rows[i].cells[columnIndex].childNodes[j];
findChildCheckBox(oj);
}
}
}
}
function findChildCheckBox(oj)
{
var result=false;
for(attr in oj)
{
if(attr=="type")
{
if(oj.getAttribute(attr)=="checkbox")
{
result=true;
try{
if(oj.checked==true)
{
oj.checked=false;
}
else
{
oj.checked=true;
}
}catch(e){}
}
}
}
if(!result)
{
for(var c=0;c<oj.childNodes.length;c++)
{
findChildCheckBox(oj.childNodes[c]);
}
}
}
</script>
生产内容,同时打通搜索引擎(SEO)与AI搜索引擎(GEO)流量入口的软件! 点击进入365建站器 »
