代碼如下<style>label{display:block;width:12px;height:12px;} .che{background:url('/public/Admin/images/h1.png') no-repeat;width:12px;height:12px;cursor: pointer;} .che:hover{background:url('/public/Admin/images/h2.png') no-repeat;width:12px;height:12px;cursor: pointer;} .selected{background:url('/public/Admin/images/h3.png') no-repeat;width:12px;height:12px;cursor: pointer;} .bgq{background-color:pink;width:20px;height:10px;}? ? ? ? </style><script> for (i in $('label')){ $('label')[i].onclick=function(e){ console.log($('label').length); for(j in $('label')){ $('label')[j].attr("class", "che"); } $(this).removeClass('che'); } } </script><form><tr id="typea">? ? ? ? ? ? ? ? ? ? <th>(1)</th>? ? ? ? ? ? ? ? ? ? <td><input type="radio" name="question1" value="1"/><label class="che" ></label></td>? ? ? ? ? ? ? ? ? ? <td><input type="radio" name="question1" value="2"/><label class="che" ></label></td>? ? ? ? ? ? ? ? ? ? <td><input type="radio" name="question1" value="3"/><label class="che" ></label></td>? ? ? ? ? ? ? ? ? ? <td><input type="radio" name="question1" value="4"/><label class="che" ></label></td> <td><input type="radio" name="question1" value="5"/><label class="che" ></label></td>? ? ? ? ? ? ? ? </tr> <tr id="typeb">? ? ? ? ? ? ? ? ? ? <th>(2)</th>? ? ? ? ? ? ? ? ? ? <td><input type="radio" name="question2" value="1"/><label class="che" )></label></td>? ? ? ? ? ? ? ? ? ? <td><input type="radio" name="question2" value="2"/><label class="che" ></label></td>? ? ? ? ? ? ? ? ? ? <td><input type="radio" name="question2" value="3"/><label class="che" ></label></td>? ? ? ? ? ? ? ? ? ? <td><input type="radio" name="question2" value="4"/><label class="che" ></label></td> ? ? <td><input type="radio" name="question2" value="5"/><label class="che" ></label></td>? ? ? ? ? ? ? ? </tr>請問jQuery的部分哪里錯了。
把radio的樣式改成自己的圖片,圖和class都沒有問題,jQuery有問題。
慕數(shù)據(jù)2591119
2016-12-14 13:56:09