会员
众包
新闻
博问
闪存
云市场
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
华丽的空白
fighting!!
博客园
首页
新随笔
联系
管理
订阅
checkbox 全选 js
js
<
script languag
=
"
javascript
"
>
function SelectAllCheckboxes(spanChk){
//
Added as ASPX uses SPAN for checkbox
var oItem
=
spanChk.children;
var theBox
=
(spanChk.type
==
"
checkbox
"
)
?
spanChk : spanChk.children.item[
0
];
xState
=
theBox.
checked
;
elm
=
theBox.form.elements;
for
(i
=
0
;i
<
elm.length;i
++
)
if
(elm[i].type
==
"
checkbox
"
&&
elm[i].id
!=
theBox.id)
{
//
elm[i].click();
if
(elm[i].
checked
!=
xState)
elm[i].click();
//
elm[i].checked=xState;
}
}
</
script
>
aspx
<
input id
=
"
chkAll
"
runat
=
"
server
"
onclick
=
"
javascript:SelectAllCheckboxes(this);
"
type
=
"
checkbox
"
/>
全选
posted @
2008-08-04 14:50
华丽的空白
阅读(
812
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告