日期:2014-05-16 浏览次数:20387 次
<div class='answerlist'> <span>本题答案:</span> <ul> <li><input name='Q1' type='radio' value='1' onclick='checkRadio(this);' />A</li> <li><input name='Q1' type='radio' value='2' onclick='checkRadio(this);'/>B</li> <li><input name='Q1' type='radio' value='3' onclick='checkRadio(this);'/>C</li> <li><input name='Q1' type='radio' value='4' onclick='checkRadio(this);'/>D</li> </ul> <span></span> </div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script> function checkRadio(obj) { var num = obj.value * 1; var msg = null; switch (num) { case 1: msg = "您选择答案的是A。"; break; case 2: msg = "您选择答案的是B。"; break; case 3: msg = "您选择答案的是C。"; break; case 4: msg = "您选择答案的是D。"; break; } $(obj).parent().parent().parent().children('span')[1].innerHTML = msg; $(obj).parent().parent().children('li').css('background-color', '#ffffff').css('font-weight', 'normal'); $(obj).parent().css('background-color', '#ff0000').css('font-weight', 'bold'); } </script>