自定义单选框选中(只能选中一个)

<script type="text/javascript">
        $(function(){var checked = document.getElementsByClassName('J_checked')
             for (var i = 0; i < checked.length; i++) {
                 checked[i].onclick = function(){
                   for (var i = 0; i < checked.length; i++) {
                       checked[i].style.background = 'url(./商品详情/shopping_xuanze@2x.png) no-repeat';
                       checked[i].style.backgroundSize = '100%';
                   }
                this.style.background = 'url(./商品详情/shopping_xuanze_click_img@2x.png';
                this.style.backgroundSize = '100%';
                 }
             }
        });
    </script>

 

posted @ 2018-01-22 09:56  松歌  阅读(415)  评论(0编辑  收藏  举报