請問,如下代碼,為啥只有慢跑實現(xiàn)了<label>標簽的意義;點擊登山,后面的小方框并沒有勾選上,但是點擊登上后面的小方框,可以勾選上。
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>form中的lable標簽</title>
</head>
<body>
<form>
? ? 你對什么運動感興趣? <br />
? ?<label for="sport">慢跑</label>
? <input type="checkbox" name="慢跑" id="sport" />
? <br />
? <label for="sport">登山</label>
? <input type="checkbox" name="登山" id="sport" />
? <br />
? <label for="sport">籃球</label>
? <input type="checkbox" id="sport" name="籃球">
??
</form>
</body>
</html>
2018-07-09
id唯一標識,id名字在每個頁面中只能允許出現(xiàn)一次,name建議使用英文
2018-07-09
<!DOCTYPE HTML>
<html>
<head>
? ?<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
? ?<title>form中的lable標簽</title>
</head>
<body>
? ?<form>
? ? ? ?你對什么運動感興趣?
? ? ? ?<br />
? ? ? ?<label for="run">慢跑</label>
? ? ? ?<input type="checkbox" name="run" id="run" />
? ? ? ?<br />
? ? ? ?<label for="mountain">登山</label>
? ? ? ?<input type="checkbox" name="mountain" id="mountain" />
? ? ? ?<br />
? ? ? ?<label for="basketball">籃球</label>
? ? ? ?<input type="checkbox" id="basketball" name="basketball">
? ?</form>
</body>
</html>
2018-07-09
據(jù)我所知,id是唯一的,class名字是相同的,id不能一樣,你再改改