<div class="test">
<h2>测试题</h2>
<div clss="test_select">
<div class="test_cont test_on">
<h3><span>1/5</span>测试题目11111111111</h3>
<p><span></span><input type="radio" name="xuanxiang1" value="1">天气晴</p>
<p><span></span><input type="radio" name="xuanxiang1" value="2">天气多云</p>
<p><span></span><input type="radio" name="xuanxiang1" value="3">天气阴</p>
<p><span></span><input type="radio" name="xuanxiang1" value="4">下雨</p>
</div>
<div class="test_cont">
<h3><span>2/5</span>测试题目22222222222</h3>
<p><span></span><input type="radio" name="xuanxiang2" value="1">天气晴</p>
<p><span></span><input type="radio" name="xuanxiang2" value="2">天气多云</p>
<p><span></span><input type="radio" name="xuanxiang2" value="3">天气阴</p>
<p><span></span><input type="radio" name="xuanxiang2" value="4">下雨</p>
</div>
<div class="test_cont">
<h3><span>3/5</span>测试题目3333333333</h3>
<p><span></span><input type="radio" name="xuanxiang3" value="1">天气晴</p>
<p><span></span><input type="radio" name="xuanxiang3" value="2">天气多云</p>
<p><span></span><input type="radio" name="xuanxiang3" value="3">天气阴</p>
<p><span></span><input type="radio" name="xuanxiang3" value="4">下雨</p>
</div>
<div class="test_cont">
<h3><span>4/5</span>测试题目44444444444</h3>
<p><span></span><input type="radio" name="xuanxiang4" value="1">天气晴</p>
<p><span></span><input type="radio" name="xuanxiang4" value="2">天气多云</p>
<p><span></span><input type="radio" name="xuanxiang4" value="3">天气阴</p>
<p><span></span><input type="radio" name="xuanxiang4" value="4">下雨</p>
</div>
<div class="test_cont">
<h3><span>5/5</span>测试题目55555555555</h3>
<p><span></span><input type="radio" name="xuanxiang5" value="1">天气晴</p>
<p><span></span><input type="radio" name="xuanxiang5" value="2">天气多云</p>
<p><span></span><input type="radio" name="xuanxiang5" value="3">天气阴</p>
<p><span></span><input type="radio" name="xuanxiang5" value="4">下雨</p>
</div>
</div>
<div class="result">您当前的得分是<span></span></div>
</div>
<script>
$(function () {
var sum = 0;
var i = 0;
var len = parseInt($(".test_cont").length);
$(".test_cont p").click(function () {
$(this).find("input").attr("checked", "checked")
var b = parseInt($(this).find("input").val());
$(this).parent().hide().next().fadeIn(100);
sum += b;
i++;
if (i >= len) {
console.log($(".result"));
$(".result").show();
$(".result span").html(sum + ‘分‘);
}
});
})
</script>