4 回答
TA贡献1条经验 获得超0个赞
.cconte div input[type='checkbox']{
position: absolute;
left:-0.2rem;
top: .1rem;
-webkit-appearance: none;
appearance:none;
-moz-appearance:none;
display: block;
width: .16rem;
height: .16rem;
border:1px solid #B5B5B5;
outline: none;
border-radius: 2px;
}
.cconte div input[type='checkbox']:checked{
background: url(/crm/images/icon/866.png) no-repeat center /cover;
border:none;
}
TA贡献1875条经验 获得超5个赞
<span><div></div></span> <a href="#">男</a>
<span><div></div></span> <a href="#">女</a>
<script>
window.onload = function(){
var divs = document.getElementsByTagName("div"),
spans = document.getElementsByTagName("span");
for(var i = 0 ; i < divs.length ; i++){
spans[i].index = i;
spans[i].onclick = function(){
divs[this.index].style.background = "red";
}
}
}
简单写了一个 ,可以做参考下。
添加回答
举报