HTML的使用中我们有时需要用到单选按钮,在HTML中我们使用radio标签就可以实现单选按钮的功能。
方法/步骤
- 1
<radio>元素使用的语法:<input name="Fruit" type="radio" value="" />
使用HTML的input标签,name为自定义,type类型为“radio”的表单。
- 2
案例演示效果。
- 3
案例代码分析。
源代码(
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>皇皇皇太子</title>
</head>
<body>
<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>
</body>
</html>
)
END