1: Form label:
<form></form>
A form is an area that contains form elements. Form elements are elements that allow users to enter information in forms (such as text fields, drop-down lists, radio buttons, check boxes, etc.).
Attributes:
action = '接口地址'
method = 'get / post'
name = '表单名称'
2: Form controls:
<input>
Attributes:
type = '控件类型'
name:属性标识表单域的名称;
Value:属性定义表单域的默认值,其他属性根据type的不同而有所变化。
maxlength:控制最多输入的字符数,
Size:控制框的宽度(以字符为单位)
1) Text box:
<input type="text" value="默认值"/>
2) Password box:
<input type="password" />
3) Submit button:
<input type="submit" value="按钮内容" />
4) Reset button
<input type="reset" value="按钮内容" />
5) Empty button:
<input type="button" value="按钮内容" />
Radio button group:
<input type=“radio” name=“ral” />男
<input type=“radio” name=“ral”
checked=“checked”/>(默认选中)女
Checkbox group:
<input type="checkbox" name="" />
<input type="checkbox" name="" disabled="disabled" />
* disabled="disabled" (禁用)
* checked="checked" (默认选中)
Drop-down list (menu):
<select >
<option>选项1</option>
<option>选项2</option>
…………
</select>
- Represents a drop-down list, the name attribute is not required
- The selected attribute is used for the default selection;
Multi-line text definition of form field:
Syntax:
<textarea name="" cols="" rows="" ></textarea>
- Multiple lines of text. The rows attribute and cols attribute are used to set the height and width of the text input window, in characters.
- Prevent the browser from dragging the window setting: {resize:none;} (css attribute)
Upload file:
Syntax:
<input type="file">