When we use the folder properties dialog box in Windows XP, we will find that the Read-only and Hidden options in the folder's Attributes category are sometimes not completely checked or unchecked, but often a state in which they are checked but the background is gray. In fact, this uncertain CheckBox state can also be expressed on the Web. In a web page, we can use <input id="chkb" type="CheckBox"> to get a CheckBox control. The most common form of this control is checked (with a checkmark) or unchecked. We can easily switch between these two states by clicking the mouse, and we can also use scripting languages to change their states, such as using JavaScript scripts: Copy code The code is as follows:chkb.checked = true; or chkb.checked = false; The following figure shows the three states that a CheckBox can display: ![]() The first and third ones are very common, and they can be set using HTML, that is, we can determine the initial state of the CheckBox through an 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, and the Indeterminate state can only be set using scripts. For example, using JavaScript scripts (indeterminate is false by default): Copy code The code is as follows:chkb.indeterminate = true; or chkb.indeterminate = false; Note : indeterminate of CheckBox is an independent property and has nothing to do with the values of checked and status of CheckBox. That is to say, it only affects the appearance of CheckBox. We can still use scripts to read the values of checked and status normally. |
<<: What kinds of MYSQL connection queries do you know?
>>: Detailed explanation of the hierarchical relationship problem caused by CSS positioning
1. Download the pip installation package accordin...
1. When the width of the adjacent floating layer o...
Table of contents 1:mysql execution process 1.1: ...
Table of contents 1. System Information 2. Shutdo...
First, let's take a look at the relative leng...
Basic Concepts Absolute positioning: An element b...
The layui table has multiple rows of data. Throug...
The commands pulled by docker are stored in the /...
This article shares with you the installation and...
Nginx can use its reverse proxy function to imple...
1. Command Introduction The date command is used ...
1. Function Mainly used to preserve component sta...
Table of contents Makefile Makefile naming and ru...
1. CDN It is the most commonly used acceleration ...
Table of contents queueMicrotask async/await Mess...