The indeterminate of the CheckBox is an independent attribute and has nothing to do with the checked and status values of the CheckBox. That is to say, it only affects the display of the CheckBox, we can still use scripts to read the checked and status values. When using the folder Properties dialog box of Windows XP, the Read-only and Hidden options in the Attributes category of the folder are sometimes not in the full checked or unchecked state, but are often in the gray state even though they have been checked. In fact, this uncertain CheckBox status can also be displayed in the Web.
On the Web page, we can use To obtain a CheckBox control. The most common form of this control is the checked (checked) or unchecked status. However, we can easily switch between the two States by clicking the mouse, you can also use the scripting language to change their statuses, such as using JavaScript scripts:
The Code is as follows:
Chkb. checked = true; or chkb. checked = false;
It is the three states that CheckBox can display:
The first and third types are very common, and they can be set using HTML. That is to say, we can determine the initial status of the CheckBox through the attribute of an html element called checked. The Indeterminate state we want to talk about here is supported in IE4.0, but it does not have the html element attribute to set its value. Instead, you can only set its Indeterminate state using a script.
For example, use a JavaScript script (the default value of indeterminate is false ):
The Code is as follows:
Chkb. indeterminate = true; or chkb. indeterminate = false;
Note:: The indeterminate of the CheckBox is an independent attribute and has nothing to do with the checked and status values of the CheckBox. That is to say, it only affects the display of the CheckBox, we can still normally use scripts to read the checked and status values.