日期:2014-05-16 浏览次数:20435 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<style>
#div1{ width:500px; height:auto; background:#A2D0FF;}
.text{ height:100px; background:#0C3; width:500px;}
.anwser{ height:100px; background:#CF6; width:500px; display:none;}
</style>
<script>
window.onload=function()
{
var oDiv=document.getElementById("div1");
var oText=oDiv.getElementsByClassName("text");
var oAn=document.getElementsByClassName("anwser");
var index=0;
var select_arr
for(var i=0;i<oText.length;i++){
select_arr=oText[i].getElementsByTagName("input");
for(var j=0;j<select_arr.length;j++){
select_arr[j].onclick=function(){
for(var i=0;i<oText.length;i++){
if(oText[i]==this.parentNode){
index=i;
}
}
oAn[index].style.display="block";
}
}
}
}
</script>
<body>
<div id="div1"><p>This is the first question description.</p>
<div class="text">
A.one<input type="radio"/>
B.two<input type="radio"/>
C.three<input type="radio"/>