日期:2014-05-16 浏览次数:20392 次
$("#btn_look_chk").click(function() { var scores = 0; var agree = ""; var trueVlue = ""; var nddaTmp = ""; for (var k = 0; k <= 9; k++) { var zhuangtai = 0; var xuan = $("input[name='xuanze" + k + "']"); for (var j = 0; j < xuan.length; j++) { var iResult = $("input[name='iResult" + k + "']"); for (var i = 0; i < iResult.length; i++) { trueVlue = iResult[i].value; if (xuan[j].checked == true) { zhuangtai = 1; agree = xuan[j].value; if (iResult[i].value == xuan[j].value) { for (var z = 0; z < iResult.length; z++) { scores += parseInt(iResult[z].id); } break; } else { //alert('您的答案是错误'); } } } } if (zhuangtai == 0) { nddaTmp = "<font color=gray>您没有答题</font>"; agree = ''; } else { nddaTmp = ''; } $("#div" + k).css("display", "block"); if(agree==trueVlue){ nddaTmp ="<img src=images/key_right.gif></img>" $("#div" + k).html("您的答案是:" + nddaTmp +" "+ "正确答案是:" + "<b>"+trueVlue+"</b>"); }else{ nddaTmp+="<img src=images/key_error.gif></img>" if(agree==""){ $("#div" + k).html(nddaTmp +" "+ "正确答案是:" + "<b>"+trueVlue+"</b>"); }else{ $("#div" + k).html("您的答案是:" + "<b>"+agree+"</b>" + nddaTmp+" "+ "正确答案是:" + "<b>"+trueVlue+"</b>"); } } } alert(scores); if (scores == 6) { scores = "满分,你太厉害了!"; } else if (scores >= 3) { scores = "恭喜及格了,真棒!"; } else { scores = "sorry,没及格,还需继续努力哦!"; } });
?