Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>js dynamically set the value of a div .html</title>
<body>
<form method= "Post" Name= "Form1" >
<label><input type= "Radio" name= "Radio" value= "1-10-Year-old" onclick= "OK (this.value);" >1-10-Year-old </label>
<label><input type= "Radio" name= "Radio" value= "11-year-old" onclick= "OK (this.value);" >11-Year-old </label>
<label><input type= "Radio" name= "Radio" value= "12-120-Year-old" onclick= "OK (this.value);" >12-120-Year-old </label>
<input type= "button" onclick= "OK ()" value= "Test selection value" >
</form>
<div id= "Test" ></div>
<script language= "javascript" type= "Text/javascript" >
<!--
function ok ()
{
var temp=document.getelementsbyname ("Radio");
for (i=0;i<temp.length;i++) {
Traverse Radio
if (temp[i].checked)
{
Alert ("You have selected" +temp[i].value);
Gets the value of the radio
document.getElementById (' Test '). InnerHTML = Temp[i].value;
}
}
}
-->
</script>
</body>