常见表单元素☺
(1)单选按钮
<input type="text" name="key1" id=""> <input type="password" name="key1" id=""> <input type="email" name="key1" id=""> name需要给值
(2)复选按钮
性别 <input type="password" name="key1" id=""> <input type="email" name="key1" id=""> <!-- 当表单中使用了 radio ,一定要为相同name的radio设置不同的value 让服务端可以辨别 -->
其中这一点重要,需提交多个选项可以,以数组形式
<!-- CheckBox如果没有选中则不会提交,如果选中提交on //选择框 --> <label for=""><input type="checkbox" name="agree" value="true">同意协议</label> <br> <!-- 需要同时提交多个选项,可以再name属性后面跟上[]/ --> <label for=""><input type="checkbox" name="funs[]" value="foot">篮球</label> <label for=""><input type="checkbox" name="funs[]" value="bask">组球</label> <label for=""><input type="checkbox" name="funs[]" value="first">第球</label> <label for=""><input type="checkbox" name="funs[]" value="e ">的球</label> <br>
(3)选择框
<!-- 默认提交value的值,没有提交的是文本 选择框--> <select name="status" id=""> <option >激活</option> <option value="">为激活</option> <option value="">袋激活</option> </select>
本文来自博客园,作者:{酿酿},转载请注明原文链接:{Http://cnblogs.com/NiangNyang}

浙公网安备 33010602011771号