表单元素

                                             

                                                 表单元素

一 、<form></form>                         

             提交哪里            提交方式 显示/隐示         新的窗口/本窗口

   格式:<form   action=提交的页面 method=get/post target=_blank/_self></form>

二、文本   

   1.文本框 type=text                                           两个只能用一个                                                                                                                                                                                                                          

           格式:<input  type=text name=”名称” value/placehoder=”文本框中的字符

                       readonly/disabled;maxlength="字的长度"/>

                readonly:锁定输入框不能写入,能提交(只能在文本框、密码框、隐藏域、文本域中使用)

                disabled:锁定输入框不能写入,同时不能提交(文本、选择、按钮都可以用)

                hidden:把此项的功能隐藏掉,能提交(都能用)

    2.密码框 type="password                                       两个只能用一个

       格式:<input  type="password" name=”名称 value/placehoder=”文本框中的 ” 

                   readonly/disabled maxlength="字的长度"/>

   

    3.隐藏域 type="hidden

      

    格式:<input  type="hidden" name=”名称” value/placehoder=”文本框中的字符

                readonly/disabled maxlength="字的长度"/>

     

    4.文本域 <textarea></textarea>

   

  格式:<textarea  rows="行数" cols=“宽度”; maxlength="字的长度" name=”名称” 

                   value/placehoder=”文本框中的字符 readonly/disabled />  </textarea>

    三、按钮<input/>

      1.普通按钮 type=button                                                        锁定不能写入

             格式:<input  type=button; name=名称; value=字符disable="disabled"/>

      2.提交按钮 type=submit

      格式:<input  type=submit; name=名称; value=字符; disable="disabled"/>

      3.重置按钮 type=reset

             格式:<input  type=reset; name=名称; value=字符; disable="disabled"/>

      4.图片按钮 type=image

             格式:<input  type=image;  name=名称;  value=字符;disable="disabled"

                        Src=图片; Width=pxheight=px/>

     

    四、选择 type=radio

        1.单选按钮 type=radio                               两个neme要一样    默认选这一项

             格式:<input  type=radio value=”D1” neme=F1checked=checked/>

                             点击字体也能选中

                          <lable  for=D1> <labble>     点: for=value的值

                                 两个neme要一样

          <input  type=radio value=”D2” neme=F1/>

                          <lable  for=D2> <labble>   重 点: for=value的值

        2. 复选框 type="checkbox"    

                                                           neme不能一样

            格式:<input  type="checkbox" name="A1" value="B1"  />

                         <label for="B1"  >张店</label>   点: for=value的值 

                     <input  type="checkbox" name="A2" value="B2" />

                          <label  for="B2" >博山</label>  点: for=value的值

                     <input  type="checkbox" name="A4" value="B3" " />

                                                  默认选中这一项

                          <label  for=B3  checked=checked>淄川</label>

   

        3.下拉列表<select><option></option></select>

      格式:<select  name=名称; size=1 >

                           <option  neme=名称 value="">凤凰</option>

                           <option  neme=名称 value="">老虎</option>

                                                                       默认选中这一项

                           <option  neme=名称 value=""selected=selected>恐龙</option>

                      </select>

原文地址:https://www.cnblogs.com/yuyan0513/p/6536212.html