<html>
<body>
<form action="" name="form1" method="post">


<br />
<label style="cursor:pointer" for="man">
<input type="radio" value="http://fanjf.iteye.com/blog/男" name="man" id="man"/>男
</label>
<label style="cursor:pointer" for="man2">
<input type="radio" value="http://fanjf.iteye.com/blog/女" name="man" id="man2"/>女
</label>
</form>

<input type="radio" id="male" name="sex" checked="checked"/><label style="cursor:pointer" for="male">男1</label>

<input type="radio" id="female" name="sex" /><label style="cursor:pointer" for="female">女1</label>

</body>
</html>

 

 

有ID的可以用以上方法,如果没有id呢,那只能自己写js了,一下方法仅供参考

 

$(".isplist").click(function(){
//alert($(this).val());
$(this).find("input[type=radio]").attr("checked", 'checked');
});

 

<div name="isp" class="isplist"><input type="radio" name="ispname" value="1"> 联通 </div>
<div name="isp" class="isplist"><input type="radio" name="ispname" value="2"> 电信 </div>
<div name="isp" class="isplist"><input type="radio" name="ispname" value="3"> 移动 </div>
<div name="isp" class="isplist"><input type="radio" name="ispname" value="4"> 铁通 </div>
<div name="isp" class="isplist"><input type="radio" name="ispname" value="5"> 长城 </div>
<div name="isp" class="isplist"><input type="radio" name="ispname" value="6"> 广电 </div>
<div name="isp" class="isplist"><input type="radio" name="ispname" value="7"> 教育网 </div>
<div name="isp" class="isplist"><input type="radio" name="ispname" value="8"> 其它 </div>

 

 window.onload = function () {
//点击radio后面的文本选中radio
//    labels = document.getElementById('scalul').getElementsByTagName('span');
//    for (i = 0, j = labels.length; i < j; i++) {
//        labels[i].onclick = function () {
//            var vastr = $(this).parents("li").find("input").val();
//            $(this).parents("li").find("input[type=radio][value=" + vastr + "]").attr("checked", 'checked');
//        }
//    }
//点击整个li选中其里面的radio
    labelsa = $(".scalul .li").find("li");
    for (i = 0, j = labelsa.length; i < j; i++) {
        labelsa[i].onclick = function () {
           var vastra = $(this).find("input").val();
            $(this).parents("li").find("input[type=radio][value=" + vastra + "]").attr("checked", 'checked');
        }
    }

}

 

posted on 2015-01-08 17:21  kingreatwill  阅读(2184)  评论(6编辑  收藏  举报