第四講:html的使用(三)

來源:互聯網
上載者:User

標籤:style   blog   http   io   ar   os   使用   sp   for   

凡事欲其成功,必要付出代價:奮鬥。——愛默生


本講內容:表單form元素


一、表單form元素介紹:html 的表單元素,主要用於讓使用者輸入資料,並提交給伺服器。

基本文法:

<form action = “url”method = “提交的方法(get/post),預設是get”>

各種元素[輸入框,下拉式清單,文本域,密碼框。。。]

</form>


get與post區別:post 表單的內容通過http發送,在地址欄中看不到表單的提交資訊


表單常用控制項

屬性 描述
input type="text" 單行文本輸入框
input type=“password” 密碼輸入框
input type="radio" 單選框
input type="checkbox" 複選框
select 列表框
textarea 多行文本輸入框
input type="submit" 將表單內容提交給伺服器的按鈕
input type="reset" 將表單全部內容全部清除,重新填寫的按鈕
input type = "image" src=
圖片
   

案例1

<html><head><title>登入介面 </title></head><body><h1>登入介面</h1><form action ="ok.html" method = "get">使用者名稱: <input type = "text" name ="username"/><br/>密  碼:<input type = "password" name ="pwd"/><br/><input type = "submit" value = "登入"/><input type = "reset" value = " 重新填寫"/><input type = "image" src="d.jpg"/></form></body></html>



案例2

*****喜歡水果*****<br/><input type = "checkbox" name ="v1">西瓜<br/><input type = "checkbox" name ="v1">蘋果<br/>*****喜歡性別*****<br/><input type = "radio" name ="sex"/>男<br/><input type = "radio" name ="sex"/>女<br/>*****隱藏(它的用處主要是,既可以提交資料,同時不影響介面)*****<br/><input type = "hidden"  value = "123"  name ="sal"/>*****喜歡圖片*****<br/><input type = "image" name="submit" align="top" src = "shan.jpg">*****下啦選擇 *****<br/>請選擇你的出生地<select name ="biradd"><option value ="">----請選擇---- </option><option value ="yj">陽江</option><option value ="sh">上海</option><option value ="ch">重慶</option></select><br/>*****請留言*****<br/><textarea  cols = "20"  row= "10">請這裡輸入….</textarea>*****請選擇你要上傳的檔案*****<br/><input type = "file" name ="myfile"/>請選擇檔案


本講就到這裡,Take your time and enjoy it


第四講: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.