表单学习及练习

这篇博客是我对form标签学习的一些认识。首先,最重要的是form不是from。

在学习过程中注意到一些问题

1.name,这个东西随便编,但是不准写汉字

2.value:这个标签的内容比较广泛。根据你的内容相机而变。

  • type="button", "reset", "submit" - 定义按钮上的显示的文本
  • type="text", "password", "hidden" - 定义输入字段的初始值
  • type="checkbox", "radio", "image" - 定义与输入相关联的值

得意好了,上代码!
 3.select:下拉框
 4. option:下拉框的子项
5. textarea:用户需要输入大量文字(如QQ的留言板)
    属性:
            rows:行数
            cols:列数
            lable:焦点集中(方便用户点中目标)


<form action="box.html" method="post"class="a1">
			姓名:
			<input type="text" name="name" id="name"
			maxlength="3" />
			<br>
			性别:
			<label><input type="radio" name="sex" id="sex" value="radio" />男</label>
			<label><input type="radio" name="sex" id="sex" value="radio" />女
			<br>
			年龄:
			<input type="date" name="" id="" value="" />
			<br>
			兴趣爱好:
			<br>
			<input type="checkbox" name="hobby"/>游太虚
			<input type="checkbox" name="hobby2"/>翻十万八七里那种跟斗
			<br>
			<input type="checkbox" name="hobby3"/>上九天揽月
			<input type="checkbox" name="hobby4"/>下五洋捉鳖
			<br>
			地区:
			<select name="city" >
				<option>南部瞻洲 </option>
				<option>东胜神州  </option>
				<option>北芦具洲  </option>
				<option>西牛贺洲</option>
			</select>
			<input type="submit" value="提交"/>
			<br>
			孙先生的账户密码:
			<input type="password" name="pass" id="pass" value="" />
			<br>
			我想对你们说:
			<textarea></textarea>
			<br>
			<button type="submit">返回并退出</button>
		</form>

效果图


猜你喜欢

转载自blog.csdn.net/mover999/article/details/80455563
今日推荐