vopp.onclick=function(){
for(var i=0;i<vlist.length;i++){
vlist[i].checked=!vlist[i].checked;
if(vlist[i].checked==false){
vll.checked=false;
}
}
}
</script>
</body>
</html>
第二个呢则是自定义复选框样式,就是可以将我们的复选框使用图片来替代,以增加酷炫的效果;而且这里我是完全运用CSS3的写法,不涉及JavaScript的;
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.box1{
width: 1000px;
height: 50px;
position: relative;
}
input{
width: 50px;
height: 50px;
opacity: 1;
display: none;
}
input+label{
display: block;
width: 50px;
height: 50px;
background: url(img/2.png);
background-size: 100%;
}
input:checked+label{
background: url(img/1.PNG);
background-size: 100%;
}
</style>
</head>
<body>
<div class="box1">
<input type="checkbox" name="" id="input1" value="" />
<label for="input1"></label>
</div>
<div class="box2">
<input type="checkbox" name="" id="input2" value="" />
<label for="input2"></label>
</div>
<div class="box3">
<input type="checkbox" name="" id="input3" value="" />
<label for="input3"></label>
</div>
</body>
</html>以上所述是小编给大家介绍的HTML页面中复选框的操作方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对软件开发网网站的支持!









