`
wenwenyuezhang
  • 浏览: 7226 次
  • 性别: Icon_minigender_1
  • 来自: 中山
社区版块
存档分类
最新评论

HTML5元素-表单

    博客分类:
  • HTML
阅读更多

HTML5元素-表单

<!-- 制作基本表单 -->
<form method = "post" action = "">
	<input/>
	<button> </button>
</form>

<!-- 配置数据编码 -->
<form enctype = "multipart/form-data">
</form>   <!-- 该编码方式用于将文件上传服务器 -->

<form enctype = "application/x-www-form-urlencoded">
</form>   <!-- 默认编码方式,不能用来将文件上传服务器 -->

<!-- 自动填写表单功能 -->
<form autocomplete = "off/on">
</form>   <!-- autocomplete 值可以是 on 和 off,默认是 off -->

<!-- 指定表单反馈信息的目标显示位置 -->
<form target = "_blank">
</form>
<!--	target值				-->
<!--	_blank 新窗口			-->
<!--	_parent 父窗口			-->
<!--	_self 当前窗口 (默认)	-->
<!--	_top 顶层窗口			-->
<!--	<frame> 指定窗框		-->



<!-- 设置表单名称 -->
<form name = "name">
</form>			<!-- 以便使用 DOM -->

<!-- 说明标签 -->
<form>
	<label for = "" form = "">标签
		<input/>
	</label>
</form>

<!-- 自动聚焦到某个input元素 -->
<form>
	<input autofocus/>
</form>

<!-- 禁用某个input元素 -->
<form>
	<input disabled/>
</form>

<!-- 对表单元素分组 -->
<form>
	<fieldset> <!-- 局部属性 name form disabled -->
		<input/>
		<input/>
	</fieldset>
	<fieldset> <!-- 局部属性 name form disabled -->
		<input/>
		<input/>
	</fieldset>
</form>

<!-- 为fieldset元素添加说明标签 -->
<form>
	<fieldset> 
		<legend> fieldset name </legend>
		<input/>
		<input/>
	</fieldset>
	<fieldset>
		<legend> fieldset name </legend>
		<input/>
		<input/>
	</fieldset>
</form>

<!-- 使用button元素 -->
<form>
	<button type = "submit"></button>  
</form>								<!-- type属性:submit(默认)		-->
									<!--		  reset 重置表单	-->
									<!--		  button 一般元素	-->
									 

				<!-- 当type为submit时 属性:     -->
				<!--	form 指定按钮关联表单	-->
				<!--	formaction				-->
				<!--	formenctype				-->
				<!--	formmethod				-->
				<!--	formtarget				-->
				<!--	formnovalidate			-->
				


<!-- HTML5中 input button和其他表单相关元素可以不放在form元素中 -->
<!-- 可以使用元素属性 form = "form id" 与某个form元素挂钩		-->

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics