<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表單</title>
<style type="text/css">
</style>
</head>
<body>
<form action="demo075_target.html">
<fieldset>
<legend>用戶信息</legend>
<label for="um">用戶名</label>
<input id="um" type="text" name="username" value="我是value"><br><br>
<label for="pwd">密碼</label>
<input id="pwd" type="password" name="password"><br><br>
</fieldset>
<fieldset>
<legend>用戶愛好</legend>
性別<input type="radio" name="gender" value="male" id="male"><label for="male">男</label>
<input type="radio" name="gender" value="female" checked="checked" id="female"><label for="female">女</label>
<br><br>
愛好<input type="checkbox" name="hobby" value="zq">足球
<input type="checkbox" name="hobby" value="lq">籃球
<input type="checkbox" name="hobby" value="ymq" checked="checked">羽毛球
<input type="checkbox" name="hobby" value="ppq" checked="checked">乒乓球
<br><br>
</fieldset>
<select name="start">
<optgroup label="女明星">
<option value="fbb">范冰冰</option>
<option value="lxr">林心如</option>
<option value="zw">趙薇</option>
</optgroup>
<optgroup label="男明星">
<option value="zbs" selected="selected">趙本山</option>
<option value="ldh">劉德華</option>
<option value="zjl">周杰倫</option>
</optgroup>
</select>
<br><br>
自我介紹<textarea name="info"></textarea>
<br><br>
<input type="submit" value="注冊(cè)" />
<input type="reset">
<input type="button" value="按鈕">
<br><br>
<button type="submit">提交</button>
<button type="reset">重置</button>
<button type="button">按鈕</button>
</form>
</body>
</html>
表單
1.表單的作用就是用來(lái)將用戶信息提交給服務(wù)器的
比如:百度的搜索框 注冊(cè) 登錄這些操作都需要填寫表單
使用form標(biāo)簽創(chuàng)建一個(gè)表單
2.form標(biāo)簽中必須指定一個(gè)action屬性剥哑,該屬性指向的是一個(gè)服務(wù)器的地址
3.當(dāng)我們提交表單時(shí)將會(huì)提交到action屬性對(duì)應(yīng)的地址
4.設(shè)置請(qǐng)求方式:method="post"
5.需要上傳文件時(shí)要加屬性: enctype="multipart/form-data"
6.使用form創(chuàng)建的僅僅是一個(gè)空白的表單,我們還需要向form中添加不同的表單項(xiàng)
7.在表單中可以使用fieldset來(lái)為表單項(xiàng)進(jìn)行分組,可以將表單項(xiàng)中的同一組放到一個(gè)fieldset中
8.在fieldset可以使用legend子標(biāo)簽恋追,來(lái)指定組名
9.使用input來(lái)創(chuàng)建一個(gè)文本框厘线,它的type屬性是text
10.如果希望表單項(xiàng)中的數(shù)據(jù)會(huì)提交到服務(wù)器中壁拉,還必須給表單項(xiàng)指定一個(gè)name屬性
11.name表示提交內(nèi)容的名字
用戶填寫的信息會(huì)附在url地址的后邊以查詢字符串的形式發(fā)送給服務(wù)器
url地址?查詢字符串
格式:
1.屬性名=屬性值&屬性名=屬性值&屬性名=屬性值&……
2.在文本框中也可以指定value屬性值赁豆,該值將會(huì)作為文本框的默認(rèn)值顯示
3.在html中還為我們提供了一個(gè)專門用來(lái)選中表單中的提示文字的label標(biāo)簽
4.該標(biāo)簽可以指定一個(gè)for屬性椎镣,該屬性的值需要指定一個(gè)表單項(xiàng)的id值
5.value是默認(rèn)值,提示信息用:placeholder="用戶名/郵箱/手機(jī)號(hào)
密碼框
1.使用input創(chuàng)建一個(gè)密碼框庶艾,它的type屬性值是password
如何制作一個(gè)表格
制作表格用在HTML中袁余,使用table標(biāo)簽來(lái)創(chuàng)建一個(gè)表在table標(biāo)簽中使用tr來(lái)表示表格中的一行,有幾行就有幾對(duì)tr在tr中需要使用td來(lái)創(chuàng)建一個(gè)單元格咱揍,有幾個(gè)單元格就有幾個(gè)td
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表格</title>