from表單中標(biāo)簽屬性
<label for="username">用戶(hù)名:</label>
????? <input type="text"? name="username" id="username" value="" />
????? <label for="pass">密碼:</label>
????? <input type="password"? name="pass" id="pass" value="" />?? ?
????? <input type="submit" value="確定"? name="submit" />
????? <input type="reset" value="重置" name="reset" />
為什么label標(biāo)簽設(shè)置 for 屬性?input 標(biāo)簽設(shè)置 name 而不是id?
2019-03-11
form
2017-03-24
input元素的name和id屬性的作用是不同的,name屬性可由客戶(hù)端和服務(wù)器端腳本使用,而id屬性創(chuàng)建的標(biāo)識(shí)符可由label元素,錨元素和CSS選擇符使用。
2017-03-24
for ?規(guī)定 label 綁定到哪個(gè)表單元素。 ? ?比如你點(diǎn)擊密碼這個(gè)文本就相當(dāng)于點(diǎn)擊了密碼框。
ID就像是一個(gè)人的身份證號(hào)碼,而Name就像是他的名字,ID顯然是唯一的,而Name是可以重復(fù)的。
HTML元素Input type='radio'分組,我們知道radio button控件在同一個(gè)分組類(lèi),check操作是mutex的,同一時(shí)間只能選中一個(gè)radio,這個(gè)分組就是根據(jù)相同的Name屬性來(lái)實(shí)現(xiàn)的。
2017-03-24
for ?規(guī)定 label 綁定到哪個(gè)表單元素。 ? ?比如你點(diǎn)擊密碼這個(gè)文本就相當(dāng)于點(diǎn)擊了密碼框。
ID就像是一個(gè)人的身份證號(hào)碼,而Name就像是他的名字,ID顯然是唯一的,而Name是可以重復(fù)的。
HTML元素Input type='radio'分組,我們知道radio button控件在同一個(gè)分組類(lèi),check操作是mutex的,同一時(shí)間只能選中一個(gè)radio,這個(gè)分組就是根據(jù)相同的Name屬性來(lái)實(shí)現(xiàn)的。