表单 form
- <form action="" method="GET">
- <div>
- <input type="text">
- #普通文本框
- <input type="password" placeholder="默认提示">
- #密码框, 隐藏输入
- <input type="checkbox">
- #复选框
- <input type="radio" checked>
- 男 #checked 默认 单选框
- <select name="" id="">
- #选项太多, 下拉框
- <option value="">
- 请选择您的学历
- </option>
- <option value="1">
- 本科
- </option>
- <option value="2">
- 专科
- </option>
- <option value="3">
- 高中
- </option>
- </select>
- <textarea name="" id="" cols="30" rows="10">
- </textarea>
- #多文本框
- <input type="submit" value='提交'>
- #提交
- <input type="reset" value='重置'>
- #重置
- <input type="button" value='按钮'>
- #普通按钮
- </div>
- </form>
- alert(document.getElementById('d1').value) alert(document.getElementById('d2').value)
- alert(document.getElementById('d3').checked) alert(document.getElementById('d4').checked)
- alert(document.getElementById('d6').value) alert(document.getElementById('d7').value)
表单控件属性:
type
name 提交名字
value 提交内容 (与实际内容一对一)
<option value="1"> 本科 </option>
提交 1 代表本科
placeholder 默认提示内容
cheched 复选单选默认
selected 下拉框默认
来源: http://www.bubuko.com/infodetail-3294705.html