CheckBox 半选中状态

<input type='checkbox' />可以半选中,这个特性,很多浏览器都支持,包括Firefox,Chrome和IE

用 input.indeterminate 这个属性来获取或者设置半选中状态。

input.indeterminate = true; //设置成半选中

if(input.indeterminate) //用这个属性来判断是否半选中

input.checked 只表示“是否选中”;半选中状态由 input.indeterminate 单独表示。半选中时 checked 可能是 true,也可能是 false,两者可以组合,不能只用 checked 判断半选中。

posted @ 2016-11-03 16:16  Easy C#  阅读(6004)  评论(1)    收藏  举报