r/CritiqueMyCode • u/Eddsbutt • Feb 22 '15
[Java] A coding virgin's attempt at entertainment, that for some reason or other doesnt work, help?
<!doctype html>
<html> <body>
<h1>Autism Test</h1>
<p id="input">Please input a number between :</p>
<p id="#1"></p>
<p>and</p>
<p id="#2"></p>
<input id="numb" type="number">
<button type="button" onclick="myFunction()">Submit</button>
<p id="demo"></p>
<script> function randomNumber1() { var z = Math.floor((Math.random() * 100) + 1); document.getElementById("#1").innerHTML = z; } function randomNumber2() { var y = Math.floor((Math.random() * 100) + 1); document.getElementById("#2").innerHTML = y; } function myFunction() { var x, text; x = document.getElementById("numb").value; if (x < n || x > m) { <p>Try again!</p> text = " "; } else { <p>Well done, you aren't autistic</p> text = " "; } document.getElementById("demo").innerHTML = text; } function logic() { if (y < z) { y = n; z = m; } else { z = m; y = n; } } randomNumber1(); randomNumber2(); logic(); </script>
</body> </html>
9
u/mcstafford Feb 22 '15
You might want to hold off on the condescension until you've at least written something that works... and/or differentiate between Java and JSP.