HTML的使用中我们有时需要用到单选按钮,在HTML中我们使用radio标签就可以实现单选按钮的功能。

方法/步骤

  1. 1

    <radio>元素使用的语法:<input name="Fruit" type="radio" value="" />

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

  2. 2

    案例演示效果。

  3. 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
(共篇)
上一篇:元素|下一篇:
经验内容仅供参考,如果您需解决具体问题(尤其法律、医学等领域),建议您详细咨询相关领域专业人士。