I need to invite a visitor for an integer from 1 to 100 and continue the request until the correct number is entered.
Here is what I have:
<script> var number = parseInt(prompt("Please enter a number from 1 to 100", "")); if (number < 100) { document.write("Your number (" + number + ") is matches requirements", ""); } else if (isNaN(number)) { parseInt(prompt("It is not a number. Please enter a number from 1 to 100", "")); } else { parseInt(prompt("Your number (" + number + ") is above 100. Please enter a number from 1 to 100", "")); } </script>
It recognizes the number, but cannot retry when the number is erroneous. Could you help me and explain what you added?
Many thanks.
Art
source share