I had this reletivly simple html/javascript document working with 2 possible outcomes (using just > or <), and I have attempted to scale it to 8 options.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Fielder's Choice Spinner</title>
<meta name="description" content="Instore spinner for FC">
<meta name="author" content="Matthew Davis">
<link href="style.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!--ill just leave this here-->
<script language="JavaScript">
var response = (function getRandomIntInclusive(min, max) {
min = Math.ceil(1);
max = Math.floor(1000);
return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive
})();
document.write(response)
function script() {
if (response == 1000) {
window.location.replace("freeorder.html")
}
if (999 >= response >= 950){
window.location.replace("15offorder/15offorder.html")
}
if (949 >= response >= 849){
window.location.replace("20offnext.html")
}
if (848 >= response >= 698){
window.location.replace("keychain.html")
}
if (697 >= response >= 497){
window.location.replace("freebaseball.html")
}
if (496 >= response >= 396){
window.location.replace("nospin1.html")
}
if (395 >= response >= 295){
window.location.replace("nospin2.html")
}
if (294 >= response >= 1){
window.location.replace("stamp.html")
}
}
</script>
</head>
<body>
<button id="link">Link</button>
<script>
document.getElementById('link').onclick = function () {
script();
};
</script>
</body>
</html>
However now the button only redirects when the criteria for stamp.html are achieved and the button is pressed. All other results the button does nothing. There are no errors in the browsers developer console. Is this an issue with the 'if' statements, or something else?
Cheers, Matt