---
title: "js原生支持checkbox框半选状态"
author: "twypx"
date: "2011-12-22T20:39:57Z"
tags: []
categories: ["Web前端"]
slug: "js-checkbox"
draft: false
lastmod: "2011-12-22T20:39:57Z"
id: 1321993
url: "https://arching.iteye.com/blog/1321993"
---

今天发现，原来JS是原生支持checkbox框的，有个属性indeterminate,其值为true/false,当为true时，checkbox就显示为绿色方块心的checkbox框。但是，该属性不能直接写在html标签里，必须使用js来赋值才行。

同时，可惜的是，该属性不支持firefox，看来在firefox下只能用图片代替了。。。