js checkbox全选与取消

checkbox选中与取消

1

2

3

4

5

6

7

8

9

10

<form>

    你爱好的运动是?<br/>

    <input type="checkbox" name="items" value="足球" />足球

    <input type="checkbox" name="items" value="篮球" />篮球

    <input type="checkbox" name="items" value="羽毛球" />羽毛球

    <input type="checkbox" name="items" value="乒乓球" />乒乓球 <br/>

    <input type="button" id="CheckAll" value="全选" />

    <input type="button" id="CheckNo" value="全不选" />

    <input type="button" id="CheckRev" value="反选" />

form>

  想要实现的是全选,全不选和反选三种效果,其中需要特别注意的是全选按钮这里

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

你可能感兴趣的:(js,checkbox)