HTML学习记录4

来源:互联网 发布:csf播放器 for mac 编辑:程序博客网 时间:2024/06/11 16:26

表单

(1)收集数据

(2)提交

写法:

<form></form>

属性:method="" 一哪种方式提交 get和post,get上传的内容会直接显示在地址栏,post上传的内容不会显示在地址栏更安全

1、文本输入框

写法:

<input  type=“text” />

属性:type=“” text为文本输入框,name=""为文本名,

value=“” 用户自己添加的内容,

placeholder="" 输入框的提示语,

autofocus或autofocus="autofocus"页面首次加载时自动获取光标,

readonly或readonly="readonly" 只读性,

disabled或disabled="disabled" 页面首次加载时禁用次标签,

maxlength="4" 限制最大的长度 <=4

2、密码输入框

写法:

<input  type=“password” />

属性:

与文本输入框一样

3、按钮

(1)普通按钮(没有任何功能)

写法:<input type="button" value="登录" />

(2)提交按钮(有提交的功能)

写法:<input type="submit" value="提交" />

(3)重置按钮(有重置的功能)

写法:<input type="reset" value="重置" />

4、单选(name相等)

写法:

<input type="radio" name="sex" value="woman"/>女
<input type="radio" naee="sex" value="man"/>男

属性:
checked或checked="checked" 默认被选

5、多选(name相等)

<input type="checkbox" name="have" value="pen"/>pen

属性:
checked或checked="checked" 默认被选

6、下拉框

写法:

<select name="pro">
<option value="安徽">安徽</option>
<option value="北京">北京</option>
<option value="上海">上海</option>
<option value="深圳">深圳</option>
</select>

属性:selected 默认被选中

7、文本域(可输入多行文本)

写法:

<textarea></textarea>

属性:

placeholder="" 提示语;

rows="" 高度;

cols=""宽度

0 0
原创粉丝点击