您的位置:首页 > 其它

checkbox 全选、半选、不选设置

2016-03-21 11:56 274 查看
html部分

<input type="checkbox" onclick="ts(this)">

js部分

function ts(cb) {
if (cb.readOnly)
cb.checked=cb.readOnly=false;
else if (!cb.checked)
cb.readOnly=cb.indeterminate=true;
}

indeterminate属性是独立属性,仅能在js中设置。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  checkbox