(3/5章)
<html>
<head>
<title>Form</title>
<script>
function check1(){
var radio1=document.getElementsByName("v1");
var radio2=document.getElementsByName("v2");
for(var i=0;i<radio1.length;i++){
if(radio1.item(i).checked==true){
var flag1 = radio1.item(i).value;
}
}
for(var j=0;j<radio2.length;j++){
if(radio2.item(j).checked==true){
var flag2 = radio2.item(j).value;
}
}
document.write("1 "+flag1+ "2 "+flag2);
}
</script>
</head>
<body>
<form action="post.php" method="post" name="add" enctype="multipart/form-data" onSubmit="return check();" >
<h1>第一題</h1>
<input name="v1" type="radio" value="A">A
<input name="v1" type="radio" value="B">B
<input name="v1" type="radio" value="C">C
</form>
<form action="post.php" method="post" name="add" enctype="multipart/form-data" onSubmit="return check();" >
<h1>第二題</h1>
<input name="v2" type="radio" value="A">A
<input name="v2" type="radio" value="B">B
<input name="v2" type="radio" value="C">C
<input type="button" value="submit" onclick="check1()"/>
</form>
</body>
</html>