input标签

来源:百度文库 编辑:神马文学网 时间:2024/05/24 05:24:32

HTML 标签

定义和用法

标签用于搜集用户信息。

根据不同的 type 属性值,输入字段拥有很多种形式。输入字段可以是文本字段、复选框、掩码后的文本控件、单选按钮、按钮等等。

HTML 与 XHTML 之间的差异

在 HTML 中, 标签没有结束标签。

在 XHTML 中, 标签必须被正确地关闭。

提示和注释:

提示:请使用 label 元素为某个表单控件定义标签。

可选的属性

DTD 指示此属性允许在哪种 DTD 中使用。S=Strict, T=Transitional, F=Frameset.

属性 值 描述 DTD 标签的 accept 属性" href="http://www.w3school.com.cn/tags/att_input_accept.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_accept.asp">accept mime_type 规定通过文件上传来提交的文件的类型。 STF 标签的 align 属性" href="http://www.w3school.com.cn/tags/att_input_align.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_align.asp">align
  • left
  • right
  • top
  • middle
  • bottom
不赞成使用。规定图像输入的对齐方式。 TF 标签的 alt 属性" href="http://www.w3school.com.cn/tags/att_input_alt.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_alt.asp">alt text 定义图像输入的替代文本。 STF 标签的 checked 属性" href="http://www.w3school.com.cn/tags/att_input_checked.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_checked.asp">checked checked 规定此 input 元素首次加载时应当被选中。 STF 标签的 disabled 属性" href="http://www.w3school.com.cn/tags/att_input_disabled.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_disabled.asp">disabled disabled 当 input 元素加载时禁用此元素。 STF 标签的 maxlength 属性" href="http://www.w3school.com.cn/tags/att_input_maxlength.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_maxlength.asp">maxlength number 规定输入字段中的字符的最大长度。 STF 标签的 name 属性" href="http://www.w3school.com.cn/tags/att_input_name.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_name.asp">name field_name 定义 input 元素的名称。 STF 标签的 readonly 属性" href="http://www.w3school.com.cn/tags/att_input_readonly.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_readonly.asp">readonly readonly 规定输入字段为只读。 STF 标签的 size 属性" href="http://www.w3school.com.cn/tags/att_input_size.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_size.asp">size number_of_char 定义输入字段的宽度。 STF 标签的 src 属性" href="http://www.w3school.com.cn/tags/att_input_src.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_src.asp">src URL 定义以提交按钮形式显示的图像的 URL。 STF 标签的 type 属性" href="http://www.w3school.com.cn/tags/att_input_type.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_type.asp">type
  • button
  • checkbox
  • file
  • hidden
  • image
  • password
  • radio
  • reset
  • submit
  • text
规定 input 元素的类型。 STF 标签的 value 属性" href="http://www.w3school.com.cn/tags/att_input_value.asp" href_cetemp="http://www.w3school.com.cn/tags/att_input_value.asp">value value 规定 input 元素的值。 STF

标准属性

id, class, title, style, dir, lang, xml:lang

如需完整的描述,请访问标准属性。

事件属性

tabindex, accesskey, onfocus, onblur, onselect, onchange,onclick, ondblclick, onmousedown, onmouseup, onmouseover,onmousemove, onmouseout, onkeypress, onkeydown, onkeyup