form标签小结

来源:互联网 发布:python 元组 列表 zip 编辑:程序博客网 时间:2024/04/30 11:16
html标签用于搜集不同类型的用户输入:
  • 文本域textarea       <textarea rows="10" cols="30">
                                   
  • 输入input
    • 密码password <input type="password" value="Password">                               
  • 文本text <input type="text" value="Text">
  • 单选框radio 男性: <input type="radio" checked="checked" name="Sex" value="male" /> <br /> 女性: <input type="radio" name="Sex" value="female" />(通过 if(this.checked==true)或者 if(this.checked==false)判断是否被选中)
                            
  • 复选框checkbox   checkbox1<input type="checkbox"><br />checkbox2<input type="checkbox" >        
                                          
  • 提交按钮submit <input type="submit" value="Submit"> 
  • 图片 image <input type="image" src="1.jpg">
  • 重置按钮 reset <input type="reset" value="Reset">
  • 按钮button <input type="button" value="Hello world!">
  • 文件选择 <input type="file" title="File" class="txt">
  • 标记控件:在 label 元素内点击文本,当用户选择该标签时,浏览器就会自动将焦点转到和标签相关的表单控件上,<label> 标签的 for 属性应当与相关元素的 id 属性相同。
                     <form>
                        <label for="male">Male</label>
                        <input type="radio" name="sex" id="male" />
                        <br />
                        <label for="female">Female</label>
                        <input type="radio" name="sex" id="female" />
                    </form>
                                                           
  • 下拉列表opition<select name="cars"> <option value="volvo" selected="selected">Volvo</option> <option value="saab">Saab</option><option value="fiat">Fiat</option> <option value="audi">Audi</option></select>
                       
  • 标题框legend:为 fieldset 元素定义标题。
  • 标题框的Fieldset:当一组表单元素放到 <fieldset> 标签内时,浏览器会以特殊方式来显示它们,它们可能有特殊的边界、3D 效果,或者甚至可创建一个子表单来处理这些元素。
          <fieldset>
                <legend>健康信息</legend>
                    身高:<input type="text" />
                    体重:<input type="text" />
          </fieldset>


0 0
原创粉丝点击