vendredi 13 février 2015

How do I use button to refresh the browser page?


I have been learning JavaScript, and have been working on a customizable random number generator. If you decide you want to do more than one, it has to be refreshed. I have tried looping, but that makes it infinite. Here is the code:



<DOCTYPE! html>
<body>
<script>
//This is a simple thingy, to randomly pick a number under a certain number

//This is how we get what they want the max to be
var input = prompt("Pick a number to be the maximum");

//This is what it will output
var output = Math.floor(Math.random() * (input + 1));
//The reason for +1 is that it never reaches the max number without it

//This is the output
alert(output);
</script>
</body>




Aucun commentaire:

Enregistrer un commentaire