HTML radio 单选框

一、单选按钮控件语法

<input name="Fruit" type="radio" value="" />

使用html input标签,name为自定义,type类型为“radio”的表单。

注意:单选框的radio name属性必行拥有相同的值。如下面实例。

 

二、radio单选按钮语法实例

<form action="" method="get"> 
您最喜欢水果?<br /><br /> 
<label><input name="Fruit" type="radio" value="" />苹果 </label> 
<label><input name="Fruit" type="radio" value="" />桃子 </label> 
<label><input name="Fruit" type="radio" value="" />香蕉 </label> 
<label><input name="Fruit" type="radio" value="" />梨 </label> 
<label><input name="Fruit" type="radio" value="" />其它 </label> 
</form> 

在线运行