HTML elements with for attributes: 1. label element; when for is used with the label element, the for attribute specifies which form element the label is bound to. 2. Output element; when for is used with the output element, the for attribute specifies the relationship between the calculation result and the elements used in the calculation.
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
HTML elements to which the for attribute applies
Element name | Description |
---|---|
##
<label for="element_id">
<form action="/jc_script/action.php">
<label for="php">PHP</label>
<input type="radio" name="lang" id="php" value="php"><br>
<label for="java">Java</label>
<input type="radio" name="lang" id="java" value="java"><br>
<label for="python">Python</label>
<input type="radio" name="lang" id="python" value="python"><br><br>
<input type="submit" value="提交">
</form>
<output for="element_id">
<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0
<input type="range" id="a" value="50">100
+<input type="number" id="b" value="50">
=<output name="x" for="a b"></output>
</form>
The above is the detailed content of Which html elements have the for attribute. For more information, please follow other related articles on the PHP Chinese website!