Home > Web Front-end > JS Tutorial > (Only valid under IE) About checkbox three-state_form effects

(Only valid under IE) About checkbox three-state_form effects

WBOY
Release: 2016-05-16 19:13:31
Original
1207 people have browsed it

From:http://www.cnblogs.com/birdshome/archive/2005/01/03/85679.html
When we use the folder properties dialog box of Windows XP, we will find that in the Attributes category of the folder The Read-only and Hidden options are sometimes not in a completely checked or unchecked state, but are often in a state where they are checked but have a gray background. In fact, this kind of uncertain CheckBox status can also be expressed in the Web.

In a Web page, we can use to get a CheckBox control. The most common form of this control is checked (marked with a tick) or unchecked state. We can use mouse clicks to easily switch between these two states. We can also use scripting languages ​​to change their states, such as using JavaScript scripts:
chkb.checked = true; or chkb.checked = false;
The following figure shows the three states that CheckBox can display:
(Only valid under IE) About checkbox three-state_form effects
The first and third are very common, and they It can be set using HTML, which means we can determine the initial state of the CheckBox through the attribute of an html element called checked. Although the Indeterminate state we are talking about here has been supported since IE4.0, there is no html element attribute to set its value. Instead, you can only use scripts to set its Indeterminate state.

For example, use JavaScript script (indeterminate defaults to false):

chkb.indeterminate = true; or chkb.indeterminate = false;

Note: CheckBox’s indeterminate is an independent The attribute has nothing to do with the checked and status values ​​of CheckBox, which means that it will only affect the appearance of CheckBox. We can still use scripts to read the checked and status values ​​normally.
-------------------------------------------------- --------------------------
From:http://www.itbody.com/doc/Html/WEB/105537297.html

Copy code The code is as follows:


Three states checkbox (change order: unchecked -> gray selected -> white selected)




checkbox changed according to onclick: Initialized to an unselected checkbox

Initialize to white selected checkbox

Initialize to gray selected checkbox

Checkbox changed according to onpropertychange:

Initialized to an unchecked checkbox





source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template