2016年6月2日 星期四

亂數<可重複>

<html>
<script>
var answer;

function radom()
{

  answer="";
  var a1 = Math.floor(Math.random()*10);
  var a2 = Math.floor(Math.random()*10);
  var a3 = Math.floor(Math.random()*10);

  answer = a1+""+a2+""+a3;
  document.write(answer);

}
   </script>
<body>
 <input type="button" value="亂數" onclick="radom()"/>
</body>

</html>

沒有留言:

張貼留言