<ul id="exerciseanswers">
<li id='0lianswer'>
<div><strong>1. He’s ___ walked out of the office.</strong></div>
<div><span class='answer' id='0answerspan'></span></div>
<div class='mcanswers'>
<label><input type="radio" name="0canswer" id="00radio" value="just or only"/>just or only</label>
<label><input type="radio" name="0canswer" id="01radio" value="just"/>just</label>
<label><input type="radio" name="0canswer" id="02radio" value="only"/>only</label>
</div>
</li>
</ul>
<input name="Check_Answers" type="button" onclick="checkanswers();" value="Check Answers"/>
<style>
#exerciseanswers li{
margin-bottom:15px;
}
#exerciseanswers label{
display:block;
}
.correct{
color:green;
}
.wrong{
color:red;
}
</style>
<script>
(function(){
var result=document.getElementById('0answerspan');
document.getElementById('0lianswer').onchange=function(e){
result.textContent=(
result.className=e.target.value.toLowerCase().replace(/'/,''')=='just'?'correct':'wrong'
)+'!';
};
})();
</script>