<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

    <script type="text/javascript">
Math.random()*4+1

      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);
      var x1,x2,x3,x4;
  
    function aaa() {
     x1=0;
     x2=0;
     x3=0;
     x4=0;

var max=20;
var min=1;
x1=Math.floor(Math.random()*(max-min+1)+min);
x2=Math.floor(Math.random()*(max-min+1)+min);
x3=Math.floor(Math.random()*(max-min+1)+min);
x4=Math.floor(Math.random()*(max-min+1)+min);
drawChart();

  }
    function add() {
    
 var radio1 = document.getElementsByName("v1");
 var radio2 = document.getElementsByName("v2");
 var radio3 = document.getElementsByName("v3");
 var radio4 = document.getElementsByName("v4");


   for(var i=0;i<radio1.length;i++)
   {
     if(radio1.item(i).checked==true)
     {
  i = i+1
     alert(i);
if (i==1)
  {
a=a+1;
  }
if (i==2)
  {
b=b+1;
  }
if (i==3)
  {
c=c+1;
  }
if(i==4)
{
d=d+1;
}

document.getElementById('c1').value=a;
document.getElementById('c2').value=b;
document.getElementById('c3').value=c;
document.getElementById('c4').value=d;

  break;
     }
   }
 for(var i=0;i<radio2.length;i++)
   {
     if(radio2.item(i).checked==true)
     {
  i = i+1
     alert(i);
if (i==1)
  {
a=a+1;
  }
if (i==2)
  {
b=b+1;
  }
if (i==3)
  {
c=c+1;
  }
if(i==4)
{
d=d+1;
}

document.getElementById('c1').value=a;
document.getElementById('c2').value=b;
document.getElementById('c3').value=c;
document.getElementById('c4').value=d;
  break;
     }
   }
for(var i=0;i<radio3.length;i++)
   {
     if(radio3.item(i).checked==true)
     {
  i = i+1
     alert(i);
if (i==1)
  {
a=a+1;
  }
if (i==2)
  {
b=b+1;
  }
if (i==3)
  {
c=c+1;
  }
if(i==4)
{
d=d+1;
}


document.getElementById('c1').value=a;
document.getElementById('c2').value=b;
document.getElementById('c3').value=c;
document.getElementById('c4').value=d;
  break;
     }
   }
for(var i=0;i<radio4.length;i++)
   {
     if(radio4.item(i).checked==true)
     {
  i = i+1
     alert(i);
if (i==1)
  {
a=a+1;
  }
if (i==2)
  {
b=b+1;
  }
if (i==3)
  {
c=c+1;
  }
if(i==4)
{
d=d+1;
}


document.getElementById('c1').value=a;
document.getElementById('c2').value=b;
document.getElementById('c3').value=c;
document.getElementById('c4').value=d;
  break;
     }
   }

      drawChart();
      }

      function drawChart() {
      
       var data = google.visualization.arrayToDataTable([
          ['Task', 'Hours per Day'],
          ['Work',     x1],
          ['Eat',      x2],
          ['Commute',  x3],
          ['bitch',x4],
        ]);

        var options = {
          title: 'My Daily Activities'
        };

        var chart = new google.visualization.PieChart(document.getElementById('piechart'));

        chart.draw(data, options);
      }
    </script>
  </head>
  <body>

<h1>你選了什麼?</h1>
<input name="v1" type="radio" value="300年">300年         
<input name="v1" type="radio" value="400年">400年           
<input name="v1" type="radio" value="1000年">1000年
<input name="v1" type="radio" value="1000年">1000年
<br>
<h1>你選了什麼?</h1>
<input name="v2" type="radio" value="300年">300年         
<input name="v2" type="radio" value="400年">400年           
<input name="v2" type="radio" value="1000年">1000年
<input name="v2" type="radio" value="1000年">1000年
<br>
<h1>你選了什麼?</h1>
<input name="v3" type="radio" value="300年">300年         
<input name="v3" type="radio" value="400年">400年           
<input name="v3" type="radio" value="1000年">1000年
<input name="v3" type="radio" value="1000年">1000年
<br>
<h1>你選了什麼?</h1>
<input name="v4" type="radio" value="300年">300年         
<input name="v4" type="radio" value="400年">400年           
<input name="v4" type="radio" value="1000年">1000年
<input name="v4" type="radio" value="1000年">1000年
<br>


c1:
 <input type="text" name="FirstName" id="c1" <br><br/>

 c2:
 <input type="text" name="address" id="c2" <br></br>

 c3:
 <input type="text" name="address" id="c3" <br></br>
c4:
 <input type="text" name="address" id="c4" <br></br>

 <input type="button" value="submit" onclick="add()"/>
 <input type="button" value="隨機" onclick="aaa()"/>

    <div id="piechart" style="width: 900px; height: 500px;"></div>

  </body>
</html>

 

1A2B

http://www.fsjh.ilc.edu.tw/Other/Game/guessnumber.html

arrow
arrow
    全站熱搜

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