1. 程式人生 > 其它 >html基礎 表單相關屬性綜合實戰案例 附有註釋

html基礎 表單相關屬性綜合實戰案例 附有註釋

html結構程式碼:
      <form >                     <!-- form 為了讓重置按鈕生效-->
            <h1>青春不常在,抓緊談戀愛</h1>
            <hr>
            暱稱: <input type="text" placeholder="請輸入暱稱"> <br><br>
               
            性別:  <input type="radio" name='sex' checked
id='man'> <label for="man">男</label> <!--點選文字選擇此項--> <input type="radio" name='sex' id='woman'> <label for="woman">女</label> <br><br> <!-- 生日: --> 生日:
<input type="date" > <br><br> 城市: <select > <option >北京</option> <option selected>上海</option> <option >廣州</option> <option >深圳</option> </select
> <br><br> <!--br換行--> 婚姻狀況: <input type="radio" name="abc" checked id='marry'> <label for="marry">未婚</label> <input type="radio" name="abc" id='married'> <label for="married">已婚</label> <input type="radio" name="abc" id='secrecy'> <label for="secrecy">保密</label> <br><br> 興趣愛好: <input type="checkbox" checked id='aw'> <label for="aw">抽菸</label> <input type="checkbox" checked id='ax'> <label for="ax">喝酒</label> <input type="checkbox" id='ae'> <label for="ae">燙頭</label> <br><br> 個人介紹: <br><br> <textarea cols="30" rows="10"></textarea> <!--textatea 區域文字框--> <h2>我承諾</h2> <ul> <!--無序類別的應用--> <li>年滿18歲、單身</li> <li>抱著嚴肅的態度</li> <li>真誠選擇另一半</li> </ul> <br> <input type="checkbox">我同意所有條款 <br> <input type="submit" value="免費註冊"> <input type="reset" > </form>