jquery attr()方法获取标签的 checked 会有问题,所以用了 prop() 方法。
Hml的checkbox没有加name,只用了 p 嵌套。
如有更好的方法,望指点!!
<p align="center"> <p id="box"> <input type="checkbox" value="1">西瓜 <input type="checkbox" value="2">芒果 <input type="checkbox" value="3">橙 <input type="checkbox" value="4">山竹 <input type="checkbox" value="5">草莓 <input type="checkbox" value="6">火龙果 </p> <br> <input type="checkbox" id="allChecked">全选 <input type="checkbox" id="invertChecked">反选 <input type="checkbox" id="orChecked">全选/反选/全不选 </p>