HTML學習之表單

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   io   使用   ar   strong   

HTML表單

表單是HTML的一個重要部分,主要用於採集和提交使用者輸入的資訊。

<form   name=“f1”     action=“處理表單用的URL”       method=“get或post” >

</form>

  1、name:   設定表單的名稱。

  2、action:  設定表單的處理常式的URL。

  3、method:提交表單的方法。


HTML    表單中常用的標記:

輸入欄位<input>一般在表單中使用

1、<inputtype=“text” />輸入單行文字

2、<inputtype=“password”/>輸入密碼

3、<inputtype=“radio” />選項按鈕

4、<inputtype=“checkbox” />多選按鈕

5、<inputtype=“image” />圖片

6、<inputtype=“file” />檔案上傳

7、<inputtype=“hidden” />隱藏欄位

8、<inputtype=“reset” />撤銷按鈕

9、<inputtype="submit" />提交按鈕

10、<inputtype=“button” />普通按鈕


11、多行文本輸入標記<textarea>

<textarea name=“t1”,rows=x,cols=x>…

</textarea>

 name 設定識別名稱。

 rows設定文本域的行數

 cols設定文本域的列數

 disabled設定文本為禁用

 warp 設定為off不換行



12、選擇域<select>

   <select name=selectname>

   <option selected>選項一</option>

   < option >選項二</option>

  ……

  </select>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">    <head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>無標題文檔</title>    </head>    <body >   <marquee direction="right" behavior="alternate" bgcolor="#3333FF">   hello,great boy.......     </marquee>      <hr>   <form>   輸入單行文字 <input type="text" /><br>   輸入密碼     <input type="password" /><br>   選項按鈕     <input type="radio" name="abc" />  <input type="radio"  name="abc" /> <br>   多選按鈕     <input type="checkbox"  name="ab"/><input type="checkbox" name="ab"/> <br>   圖片域       <input type="image" src="29.gif" /><br>   檔案上傳     <input type="file" /> <br>   隱藏欄位       <input type="hidden" /><br>   撤銷按鈕     <input type="reset" value="撤銷按鈕" /> <br>   提交按鈕     <input type="submit"  value="提交按鈕" /> <br>   執行指令碼     <input type="button"  value="普通按鈕" onclick="prompt() " /> <br>      <textarea name="t1" rows="4" cols="50">   文本域   </textarea>   <br>   <hr>   <select name="selectname">   <option>中國</option>   <option selected="selected">美國</option>   <option>日本</option>   </select>   </form>    </html>


HTML表單提交資料:html提交資料時必須設定<input>標籤name和value屬性,以便asp程式能擷取相應的值。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">    <head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>無標題文檔</title>    </head>    <body >     <form  name="form1" action="request.asp" method="post">     <p>     請輸入使用者名稱: <input name="name" type="text" size="10"  maxlength="7" />     <br>          請輸入密碼:     <input  name="password" type="password" size="10" maxlength="6"/>     <br>     選擇強項:<br>     體育<input type="checkbox"  name="ck"   value="體育" />     音樂<input type="checkbox"  name="ck"   value="音樂" />     跳舞<input type="checkbox"  name="ck"   value="跳舞" />     <br>     性別:<br>     男<input type="radio"  name="sex"  value="男"  checked="checked" /> 女<input type="radio" name="sex" value="女" />     <br>          <select name="sn">     <option selected="selected"> 中國</option>     <option>美國</option>     <option>韓國</option>     </select>     <br>          <input name="確定"  type="submit" id="確定"  value="提交" />     <input name="重設"  type="reset" value="重設">                <p>          </form>    </body>  </html>





HTML學習之表單

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.