iT邦幫忙

2024 iThome 鐵人賽

DAY 9
0

今天要介紹的是<input>中的type屬性~

<input>是表單中常見的標籤,用來接收用戶輸入。

根據type屬性,可以接收不同類型的數據。

1.text : 單行文本輸入。

<form>
   <label for="username">用戶名:</label>
   <input type="text" name="username">
</form>

https://ithelp.ithome.com.tw/upload/images/20240918/20168630X80CF5p75U.png


2.password : 隱藏用戶輸入的密碼。

<form>
    <label for="password">密碼:</label>
    <input type="password" name="password">
</form>

https://ithelp.ithome.com.tw/upload/images/20240918/201686305lIrmW11Bu.png


3.email : 限制輸入格是為有效的電子郵件地址。

<form>
    <label for="email">電子郵件:</label>
    <input type="email" name="email">
</form>

https://ithelp.ithome.com.tw/upload/images/20240918/20168630LkvYlfeXZY.png


4.number : 僅允許輸入數字。

<form>
    <label for="age">年齡:</label>
    <input type="number" name="age">
</form>

https://ithelp.ithome.com.tw/upload/images/20240918/20168630escWWdDx1j.png



今天先介紹上半部分,明天接著下半部分~謝謝觀看!/images/emoticon/emoticon08.gif


上一篇
探險日記 DAY 8
下一篇
探險日記 DAY 10
系列文
30天前端之旅:探索web開發的探險日記19
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言