Introduction to the indeterminate attribute of checkbox _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.