標籤: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的使用(三)