前端html——表单及其属性

各类属性
disabled禁用表单,不可对输入框进行更改
maxlength最大输入长度

		<h1>报名表</h1>
		姓名<input type="text" disabled="" maxlength=""/>
		<br />
		密码<input type="password" />
		<br />

在这里插入图片描述

性别:男<input type="radio" name="sex" checked="checked"/>女<input type="radio" name="sex"/>

checked="checked"单选框默认值选中
name相同即可成为单选、表单上传的是value值
在这里插入图片描述

家庭条件:
		存款百万<input type="checkbox" name="family[]"/>
	          良田百亩<input type="checkbox" />
	          家有豪宅<input type="checkbox" />

name相同且值的后面加[]、表单上传的是value值,上传的数据显示为name[]的数组
在这里插入图片描述


	         学历:<select size="2">
	         	<option>大专</option>
	         	<option>本科</option>
	         	<option selected="selected">硕士</option>
	         	<option>博士</option>
	         	<option>院士</option>
	         	<option>圣斗士</option>
	         </select>

selected="selected"下拉列表默认选中
size="2"下拉列表默认显示几个值
在这里插入图片描述

照片:<input type="file" />

在这里插入图片描述

<form>
			<input type="text" />表示单行文本
			<input type="password" />表示密码
			<input type="radio" />单选框
			<input type="checkbox" />复选框
			<input type="hidden" />隐藏域
			<input type="file" />文件域
			<input type="reset" />重置按钮
			<input type="submit" />提交
			<textarea name="" rows="" cols=""></textarea>多行文本
			<select name="">下拉列表
				<option>html</option>
				<option>js</option>
			</select>
		</form>

猜你喜欢

转载自blog.csdn.net/qq_41141657/article/details/87340789