HTML5 成长之路 (四)表单、表单域与表单控件

Show me the code

将代码保存为.html格式结尾的文件并用浏览器查看结果

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>表单、表单域、表单控件</title>

	<style>
		caption {
			font-size: 30px;
			color: blue;
		}
	</style>
</head>
<body>
	<h1>表单、表单域、表单控件</h1>
	<!-- 
		form标签的action属性是提交给哪个文件或者地址
		method属性可以选择:get,即url后?xxxx&xxxx的形式
						  post,即匿名提交
	 -->
	<form action="">
		<table align="center" cellpadding="10" border="1">
			<caption>input标签输入控件,不同属性type</caption>
			<thead>
				<tr>
					<td>说明</td>
					<td>对应input控件</td>
				</tr>
			</thead>

			<tbody>
				<tr>
					<td>type="text"</td>
					<td><input type="text"></td>
				</tr>

				<tr>
					<td>type="password"</td>
					<td><input type="password"></td>
				</tr>

				<tr>
					<td>type="radio",name="num"</td>
					<td>
						1 <input type="radio" name="num">
						2 <input type="radio" name="num">
					</td>
				</tr>

				<tr>
					<td>checked属性的单选默认</td>
					<td>
						默认被选中 <input type="radio" name="num1" checked="checked">
						默认没有被选中 <input type="radio" name="num1">
					</td>
				</tr>

				<tr>
					<td>type="button", value="按钮"</td>
					<td><input type="button" value="按钮"></td>
				</tr>

				<tr>
					<td>type="submit", value="提交"</td>
					<td><input type="submit" value="提交"></td>
				</tr>

				<tr>
					<td>type="reset", value="重置"</td>
					<td><input type="reset" value="重置"></td>
				</tr>

				<tr>
					<td><label for="thisText">label标签,for属性,type="text"的效果</label></td>
					<td><input type="text" id="thisText"></td>
				</tr>
				
				<tr>
					<td>select标签内含option标签的选择菜单</td>
					<td>
						<select name="" id="">
							<option value="">第一个值</option>
							<option value="">第二个值</option>
							<option value="">第三个值</option>
						</select>
					</td>
				</tr>

				<tr>
					<td>textarea标签</td>
					<td><textarea name="" id="" cols="30" rows="10"></textarea></td>	
				</tr>

				<tr>
					<td>type="file"</td>
					<td><input type="file"></td>	
				</tr>

				<tr>
					<td>type="image"</td>
					<td><input type="image" src="https://www.baidu.com/img/bd_logo1.png" alt="图像拉取失败" title="百度logo" width="100"></td>
				</tr>

			</tbody>
		</table>
	</form>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值