1. 程式人生 > >html-4, form 表單 輸入、傳文件、單選、多選、下拉菜單、文本描述、重置、submit、按鈕限制輸入

html-4, form 表單 輸入、傳文件、單選、多選、下拉菜單、文本描述、重置、submit、按鈕限制輸入

part row man head 密碼 文本 inpu set 跳轉

<!--
    form
            HTTP協議
            action:提交的服務器網址
            method:get(默認)| post(應用:登錄註冊、上傳文件)
            頁面中的a img link 默認是get請求
            
            input
                type:
                    text: 文本輸入框
                    password:密碼輸入框
                    file:文件按鈕 提交文件的時候一定要用post 一定要給form標簽添加 Enctype=‘multipart/form-data‘
                    submit:提交按鈕  input 中一定有submit按鈕才能提交跳轉等任務
                    button:普通按鈕
                name:提交到服務器端的key
                value: 顯示的文本內容,與服務器端的value
                placeholder:文本代替
                
            placeholder  表單內顯示的灰色提示語    
            type
                text  文本輸入
                file  傳入文件  註意傳入文件定要使用post方式 因為網站欄輸入大小有限
                        
            label   表單前的標語
                for:是與下面的某個表單控件的id屬性進行關聯
--> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <!--Enctype=‘multipart/form-data‘ 提交文本一定給form 設置這一段--> <form action="" method="get" enctype="multipart/form-data"> <!--
placeholder 表單內顯示的灰色提示語 label 表單前的標語 type text 文本輸入 file 傳入文件 註意傳入文件定要使用post方式 因為網站欄輸入大小有限 --> <p class="user"> <label class="user_name">用戶名</label> <input type
="text" name="username" id="username" placeholder="請輸入用戶名"> </p> <p class="pwd"> <label class="user_pwd">用戶名</label> <input type="text" name="password" placeholder="請輸入密碼"> </p> <!--文件上傳--> <p> <input type="file" name="mp3"> </p> <!--單選 checked 默認--> <p> 男:<input type="radio" name="sex" value="man"> 女:<input type="radio" name="sex" value="woman" checked> </p> <!--多選--> <p> 愛好:<input type="checkbox" name="love" value="eat">吃飯 <input type="checkbox" name="love" value="sleep">睡覺 <input type="checkbox" name="love" value="bat">打豆豆 </p> <!--下拉菜單單選 selected 默認--> <p> <select name="school"> <option value="1">小學</option> <option value="2">初中</option> <option value="3">高中</option> <option value="4">大學</option> <option selected>研究生</option> </select> </p> <!--描述 即文本框 可以寫文字的框--> <p> <h3>我的描述</h3> <textarea name="" id="" cols="60" rows="10"></textarea> </p> <!--重置、限制輸入數字等按鈕等按鈕--> <p class="register"> <input type="submit" value="註冊"> <input type="button" value="普通按鈕"> <!--重置會 將所選的按鈕都變為初始狀態--> <input type="reset" value="重置"> <!-- 只允許輸入數字 --> <input type="number"> <button type="button">普通按鈕</button> </p> </form> </body> </html>

html-4, form 表單 輸入、傳文件、單選、多選、下拉菜單、文本描述、重置、submit、按鈕限制輸入