BrU32

JS Massive Dice Roller SRC

Jul 22nd, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <center>
  2. Guess #(1-12):<br>
  3. <input type="text" id="t1" style="width:190" value="1"></input><br>
  4. Roll Ammount:<br>
  5. <input type="text" id="t2" style="width:190" value="69"></input></br>
  6. <button onclick="MassRollIt();">Roll The Dice</button><button onclick="t1.value=('');
  7. t2.value=('');">Clear All Data</button>
  8. <script>
  9. function MassRollIt()
  10. {
  11.  
  12. //Massive Dice Roller
  13.  
  14. //Coded By BrÜ
  15.  
  16.  
  17. var score=0;
  18. var inn=t1.value;
  19. var inn1=t2.value;
  20. for(var i=0; i<inn1; i++){
  21. var out=Number(Math.floor(Math.random()*12+1));
  22. if(inn==out){
  23. score=score+1;
  24. }
  25. }
  26. document.body.innerHTML=document.body.innerHTML+("<br><center>Total Guesses: "+inn+"<p>Total Rolls: "+inn1+"<p>Total Wins: "+ score);
  27. }
  28. </script>
  29. </center>
Advertisement
Add Comment
Please, Sign In to add comment