創(chuàng)建單選鈕控件。
Creates a radio button control.
使用單選鈕可以將用戶可選擇的范圍限制到一組值中的一個(gè)。要實(shí)現(xiàn)這一功能,你必須為同一組的單選鈕取相同的 name 值。
當(dāng)用戶提交表單時(shí),只有選中的單選鈕才會(huì)提交其 name / value 的對值,如果該單選鈕有值的話。
要將一組單選鈕中的一個(gè)設(shè)置為默認(rèn)按鈕,請將該單選鈕的 checked 屬性設(shè)置為 true。
只有當(dāng)單選鈕指定了 name 屬性時(shí),用戶才能夠選擇該單選鈕。要取消對某單選鈕的選中,用戶必須選擇該單選鈕組中的另外一個(gè)。
此元素在 Internet Explorer 3.0 及以上版本的 HTML 和腳本中可用。
此元素是一個(gè)內(nèi)嵌元素。
此元素不需要關(guān)閉標(biāo)簽。
Use a radio button control to limit a user‘s selection to a single value within a set of values. To do this, you must link together each button in a set of radio buttons by assigning each button the same name.
When a user submits a form, a selected radio button only generates a name/value pair in the form data if the button has a value.
To select a radio button as the default button in a set, set the checked property of the button to true.
A user can select a radio button only if the button has a name. To clear a selected radio button, a user must select another button in the set.
The INPUT type=radio element is available in HTML and script as of Internet Explorer 3.0.
This element is an inline element.
This element does not require a closing tag.
<input type="radio" name="fruit" value = "Apple">蘋果<br>
<input type="radio" name="fruit" value = "Orange" checked>桔子<br>
<input type="radio" name="fruit" value = "Mango">芒果<br>
演示示例:使用單選鈕,讓用戶在一組選項(xiàng)里只能選擇一個(gè)