Html基础:表单&单/多选框&文本框&文件框&按钮

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<!-- form表单,用于提交数据,对用户不显示
			acation表示提交数据的地址,method表示提交方式,常用的有get和post
			定义name的标签数据可以提交,未定义则不提交 -->
		<!-- 表单的通用属性:
			readonly表示只读,可以提交数据不能修改
			disabledb表示禁用,不能修改也不能提交 -->
		<form action="" method="">
			<!-- 表单默认提交数据方式为url编码字符串的方式,这种方式提交文件职能提交文件名 
				默认值为:enctype="application/x-www-form-urlencoded"
				需要改为流的提交方式 enctype="multipart/form-data" -->
			
			<!-- 文件域 -->
			<input type="file" name="c">
			<!-- 表单分租 -->
			<fieldset id="">
				<legend>分租1</legend>
				<!-- 输入框
					type表示输入框的种类,text为文本框,password未密码框 -->
				<input type="text" name="a"  value="默认值" />
				<input type="password" name="b" />
				<!-- 多行文本域
					rows表示高度,cols表示宽度,单位为字节,根据不同语言字节占用空间不一致大小可能产生变化 -->
				<textarea rows="10" cols="30"></textarea>
				<!-- 下拉框 -->
				<select name="c">
					<!-- option标签中的内容为展示给用户的,value为提交数据时发送后台的实际数据
						如果未定义value,则值为option标签中的内容,如果定义value没写值则发送空 -->
					<option value="1">1</option>
					<!-- selected表示默认选中,html4中写法为 selected=“selected” html5写 selected即可-->
					<option value="2"selected>2</option>
				</select>
			</fieldset>
			<fieldset id="">
				<legend>分租2</legend>
				<!-- 单选框
					单选框仅能单选,不能取消。name相同的为一组 -->
				<input type="radio" name="d"  value=""/>
				<input type="radio" name="d"  value=""/>
				<!-- 多选框
					多选框可以多选也可以取消。name相同为一组 -->
				<input type="checkbox" name="e" value="" />
				<input type="checkbox" name="e" value="" />
				<!-- checked表示多选框的默认选中 -->
				<input type="checkbox" name="e" value="" checked/>
			</fieldset>
		</form>
		<!-- 常见的按钮 -->
		<!-- submit有默认值为“提交”,其他内容可以通过value设置 -->
		<input type="submit"/>
		<input type="button" value="提交"/>
		<!-- reset表示还原当前表单内容为默认内容 -->
		<input type="reset" />
		<button >提交</button>
		<button type="submit">提交</button>
		<button type="reset">重置</button>
		<!-- 图片提交按钮 -->
		<input type="image" src="../image/zun.png" />	
	</body>
</html>


版权声明:本文为weixin_52854090原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。