在使用表单设计调查表时,为了减少用户的操作,使用选择框是一个好主意,html中有两种选择框,即单选框和复选框,两者的区别是单选框中的选项用户只能选择一一项,而复选框中用户可以任意选择多项,甚至全选。 
 
请看下面的例子: 
<input type="radio/checkbox" value="值" name="名称" checked="checked" /> 
 
1.type: 
 
当type="radio"时,控件为单选框 
当type="checkbox"时,控件为复选框 
 
2.value:提交数据到服务器的值(后台程序php使用) 
 
3.name:为控件命名,以备后台程序asp,php使用 
 
4.checked:当设置checked="checked"时,该选项被默认选中 
 
任务:下面的代码中有一些错误,请修正 
 
- <html>
 
 -                 <head>
 
 -                 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
 -                 <title>单选框、复选框</title>
 
 - </head>
 
 -                 <body>
 
 -                 <form action="save.php" method="post" >
 
 -                     <label>性别:</label>
 
 -                     <label>男</label>
 
 -                     <input type="radio" value="1"  name="gender-man" />
 
 -                     <label>女</label>
 
 -                     <input type="radio" value="2"  name="gender-woman" />
 
 -                 </form>
 
 -                 </body>
 
 -                 </html>
 
  复制代码 
 
 |   
         
 
 
 | 
| 
                                
            
                                
 | 
| 
 | 
| 
 | 
                                    
共 0 个关于本帖的回复 最后回复于 2015-10-19 15:55