if($(this).is(':checked')){

$(this).attr("checked","checked");

$(this).parent().removeClass("c_off").addClass("c_on");

}else{

$(this).removeAttr("checked");

$(this).parent().removeClass("c_on").addClass(" c_off");

}

});

$("input[type='radio']").click(function(){

$("input[type='radio']").removeAttr("checked");

$(this).attr("checked","checked");

$(this).parent().removeClass("r_off").addClass("r_on").siblings().removeClass("r_on").addClass("r_off");

});

});

</script>

</head>

<style>

/* 多选/单选 */

label {

display: block;

cursor: pointer;

line-height: 26px;

margin-bottom: 20px;

width: 26px;

height: 26px;

line-height: 26px;

float: left;

margin-top: 6px;

}

.radios {

padding-top: 18px;

border-top: 1px solid #049CDB;

}

.label_check input, .label_radio input {

margin-right: 5px;

}

.lblby .label_check, .lblby .label_radio {

margin-right: 8px;

}

.lblby .label_radio, .lblby .label_check {

background: url(../images/jxc_btn.png) no-repeat;

}

.lblby .label_check {

background-position: 0 0px

}

.lblby label.c_on {

background-position: 0 -26px;

}

.lblby .label_radio {

background-position: 0 -52px;

}

.lblby label.r_on {

background-position: 0 -78px;

}

.lblby .label_check input, .lblby .label_radio input {

position: absolute;

left: -9999px;

}

</style>

<body>

<label for="checkbox-01">

<input type="checkbox" checked="checked" value="1" id="checkbox-01" name="sample-checkbox-01" />

Checkbox1 </label>

<label for="checkbox-02">

<input type="checkbox" value="1" id="checkbox-02" name="sample-checkbox-02" />

Checkbox2</label>

<label for="radio-01">

<input type="radio" value="1" checked="checked" id="radio-01" name="sample-radio" />

Radio1 </label>

<label for="radio-02">

<input type="radio" value="1" id="radio-02" name="sample-radio" />

Radio2 </label>

<label for="radio-03">

<input type="radio" value="1" id="radio-03" name="sample-radio" />

Radio3 </label>

</body>

</html>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新XHTML学习
热门XHTML学习
网页设计子分类