tailieunhanh - HTML cơ bản - p 13
104 Chapter 2: The HTML Language for instance. Radio buttons are controls that work such that one and only one button is “on” at any time. When you click a different radio button, the button that was on goes “off,” and the button you just clicked becomes the “on” button. Radio buttons are created by input elements with the type attribute set to "radio". A radio button is a member of a set if it has the same value for its name attribute as other radio buttons in the same For example: Male Female Other The value attribute supplies the value. | 104 Chapter 2 The HTML Language for instance. Radio buttons are controls that work such that one and only one button is on at any time. When you click a different radio button the button that was on goes off and the button you just clicked becomes the on button. Radio buttons are created by input elements with the type attribute set to radio . A radio button is a member of a set if it has the same value for its name attribute as other radio buttons in the same For example input type radio name sex value male checked Male input type radio name sex value female Female input type radio name sex value other Other The value attribute supplies the value that the form returns if the corresponding button is the last one clicked when the form is submitted. Note that no default value is returned if the user ignores a group of radio buttons. Any default value must be specified by adding the checked attribute as in the preceding code snippet. If more than one element in a group of radio buttons has the checked attribute the last one encountered becomes the default. Enclosing an input element and its description in a label element extends the button s sensitivity. For example label input type radio name sex value female Female label Clicking the word Female is the same as clicking the adjacent button. This is a friendly interface item that users appreciate. Adding a for attribute to the label element allows the author to place the label somewhere else on the page such as in another table cell. The for attribute s value matches the id attribute s value of the associated control as in this code snippet tr th align right input type radio name sex id choice-other value other th td align left label for choice-other Other label td tr An input element with a type attribute value of checkbox creates a single checkbox. Unlike radio buttons each checkbox stands alone and has a unique 5. This is an exception to the rule that names should be unique. From the Library of Wow eBook .
đang nạp các trang xem trước