当checkbox的indeterminate设置为true的时候, input会变成灰色打勾的状态. IE一直支持此属性, 而Firefox却不支持.不过在最新的Firefox3.6中, 也开始支持这个属性了. 我们可以用简单的javascript来实现三态checkbox.
$("input:checkbox").live("click",function() { if(this.getAttribute("checked") && !this.getAttribute("indeterminate")) { this.setAttribute("indeterminate", true); this.setAttribute("indeterminate-status", true); return false; } else if(!this.getAttribute("indeterminate") && this.getAttribute("indeterminate-status")) { this.setAttribute("checked", true); this.removeAttribute("indeterminate-status"); return true; } });