(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>

 

222.png

444.png

5555.png

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 jimin01013 的頭像
    jimin01013

    jimin01013的部落格

    jimin01013 發表在 痞客邦 留言(0) 人氣()