Forms basics

<! - form element
<form action = "position of the submitted form" method = "submit the">
<INPUT type = "element type form" name = "key" vaule = "value">

</ form>
submitted way (two kinds): 1, get way: the way of all the form elements to form key-value pairs submitted to the server in the url
submission address: key 1 = value 1 & key = value2? user + zhangsan & pwd = & hide = 123 # 123456
data size submitted limited, unsafe
2, post way
submit security, the data size is not restricted

form element Type:
Text Type:
text box: text (placeholder, can be a gray word shown in the box)
password box: password
hidden fields: hidden
button type:
Submit: submit button
rESET: reset button
button: normal button
to select the type:
1, radio: radio
Note: group name attribute needs to be set (because the values required radio)
2, multi-select buttons: the CheckBox

label label, braille will be able to choose options
checked attribute, select the default
file type:
file attributes: file Upload
drop-down box:

<option value = "value 1"> Option 1 </ Option>
<option value = "value2"> Option 2 </ Option>
<option value = "value 3"> Option 3 </ Option>
</ SELECT>
Default value: selected
text field:
<TextArea> </ TextArea>


->
</ head>

<body>
<form action="#" method="post">
用户名:<input type="text" name="user" placeholder="请输入用户名"> <br>
密码: <input type="password" name="pwd"><br>
<input type="hidden" name="hide" value="123">
性别:
<label>男<input type="radio" name="sex" value="man" checked></label>
<label>女<input type="radio" name="sex" value="women"></label> <br>
爱好:
足球<input type="checkbox" name="hobby" value="zq" checked>
蓝球<input type="checkbox" name="hobby" value="lq">
排球<input type="checkbox" name="hobby" value="pq"> <br>
文件上传:
<input type="file"> <br>
城市:
<select name="city" >
<option value="zb">淄博</option>
<option value="bj" selected>北京</option>
<option value="sh">上海</option>
</select> <br>
个人简介:
<textarea name="person" id="" cols="30" rows="10"></textarea>
<input type="submit" value="提交">
<input type="reset" value="重置">
<input type="button" value="普通按钮">
</form>

Guess you like

Origin www.cnblogs.com/hankai2735/p/11040263.html