Home > Article > Web Front-end > Summarize some uses of HTML form
最近研究 form标签,有一些小心得写下来与大家分享分享,共勉。在小结的最后有一个form表单的小例子,可以作为参考。 -----DanlV
form是HTML的一个极为重要的功能标签之一。
1.button button (more details below)
2.file is used for file selection
3.hidden hidden field, which can realize hidden operations
4.text Used for text input
5.password input with password
6.radio radio button, the same name attribute is a group
7.checkbox multi-select button, the name attribute is the same group
8.image image form submit button
9.reset reset form button
10.submit submit form button
The value of checked is true or false, or it can be written directly as checked
2.type="submit"Submit form form Function button
3.type="reset"Reset form form function related function button
2.multiple attribute, stipulates that multiple items can be selected at the same time
3.name attribute, drop-down The name of the list
4.size attribute, the number of visible items in the menu
---Group related elements in the form fieldset
<form action="" method="post"> <fieldset> <legend>天下第一争霸赛</legend> <label > 门派: <input type="text" name="menpai" id=""></label> <br><label >密码: <input type="password" name="psw" id=""> </label> <br><label >上传你的请柬: <input type="file" name="qingjian" id=""></label> <br>选武器: <input type="radio" name="arms" id="">刀 <input type="radio" name="arms" id="">剑 <input type="radio" name="arms" id="">枪 <input type="radio" name="arms" id="">鞭 <br>挑战对手: <input type="checkbox" name="Army" id="">梅超风 <input type="checkbox" name="Army" id="">洪七 <input type="checkbox" name="Army" id="">金毛狮王谢逊 <input type="checkbox" name="Army" id="">张三丰 <br><label > 选择你的门派:<select name="" id="" > <optgroup label="西域"> <option value="天山">天山派</option> <option value="昆仑">昆仑派</option> </optgroup> <optgroup label="中原" > <option value="峨眉">峨眉派</option> <option value="少林">少林派</option> <option value="武当" selected>武当派</option> <option value="天龙">天空派</option> <option value="星宿">星宿派</option> <option value="逍遥">逍遥派</option> <option value="丐帮">丐帮派</option> <option value="五毒">五毒派</option> <option value="明教">明教派</option> </optgroup> </select></label> <br> <input type="image" src="" alt="假装有图片"> <br> <input type="reset" value="重置"> <input type="submit" value="确定"> </fieldset> </form>
The above is the detailed content of Summarize some uses of HTML form. For more information, please follow other related articles on the PHP Chinese website!