title: Use Random Number To Change HTML
body: <blockquote>
    <p>What is wrong with this JavaScript? It should work, but after testing it, it does not! What am I doing wrong? When I test this in Chrome the console errors are: "index.html:129 Uncaught SyntaxError: Unexpected end of input" and "index.html:43 Uncaught TypeError: response is not a function at HTMLButtonElement.onclick" What is the fix to these errors in relation to the script below?</p>
  </blockquote>
  
  <pre><code>&lt;style&gt;
  body {
  background-color: black;
  font-family: 'courier new';
  }
  .yellow {
  font-family: 'courier new';
  font-weight: bold;
  color: yellow;
  }
  .red {
  font-family: 'courier new';
  font-weight: bold;
  color: red;
  }
  .green { 
  font-family: 'courier new';
  font-weight: bold;
  color: green;
  }
  h1, .h2 {
  color: white;
  font-family: 'courier new';
  }
  p, h2 {
  color: white;
  font-family: 'courier new';
  line-height: 150%;
  }
  button {
  display: inline-block;
  cursor: pointer;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;8-Ball&lt;/h1&gt;
  &lt;p&gt;These are the normal answers you'd expect from an 8-ball! 
  &lt;br&gt;Ask a yes or no question and 
  &lt;button onclick="response()"&gt;Refresh!&lt;/button&gt;
  for a different answer.&lt;/p&gt;
  &lt;h2 class="h2" id="response"&gt;&lt;/h2&gt;
  &lt;script type="text/javascript"&gt;
  function response(){
  var randnum;
  randnum = Math.floor((Math.random() * 20) + 1);
  //8-ball Icosahedron Answers
  if (randnum == 1) {
  document.getElementById("response").setAttribute("class", "green");
  document.getElementById("response").innerHTML = "Signs point to yes.";
  }
  if (randnum == 2) {
  document.getElementById("response").setAttribute("class", "green");
  document.getElementById("response").innerHTML = "Yes.";
  }
  if (randnum == 3) {
  document.getElementById("response").setAttribute("class", "yellow");
  document.getElementById("response").innerHTML = "Reply hazy, try again.";
  }
  if (randnum == 4) {
  document.getElementById("response").setAttribute("class", "green");
  document.getElementById("response").innerHTML = "Without a doubt.";
  }
  if (randnum == 5) {
  document.getElementById("response").setAttribute("class", "red");
  document.getElementById("response").innerHTML = "My sources say no.";
  }
  if (randnum == 6) {
  document.getElementById("response").setAttribute("class", "green");
  document.getElementById("response").innerHTML = "As I see it, yes.";
  }
  if (randnum == 7) {
  document.getElementById("response").setAttribute("class", "green");
  document.getElementById("response").innerHTML = "You may rely on it.";
  }
  if (randnum == 8) {
  document.getElementById("response").setAttribute("class", "yellow");
  document.getElementById("response").innerHTML = "Concentrate and ask again.";
  }
  if (randnum == 9) {
  document.getElementById("response").setAttribute("class", "yellow");
  document.getElementById("response").innerHTML = "Outlook not so good.";
  }
  if (randnum == 10) {
  document.getElementById("response").setAttribute("class", "green");
  document.getElementById("response").innerHTML = "It is decidedly so.";
  }
  if (randnum == 11) {
  document.getElementById("response").setAttribute("class", "yellow");
  document.getElementById("response").innerHTML = "Better not tell you now.";
  }
  if (randnum == 12) {
  document.getElementById("response").setAttribute("class", "red");
  document.getElementById("response").innerHTML = "Very doubtful.";
  }
  if (randnum == 13) {
  document.getElementById("response").setAttribute("class", "green");
  document.getElementById("response").innerHTML = "Yes - definitely.";
  }
  if (randnum == 14) {
  document.getElementById("response").setAttribute("class", "green");
  document.getElementById("response").innerHTML = "It is certain.";
  }
  if (randnum == 15) {
  document.getElementById("response").setAttribute("class", "yellow");
  document.getElementById("response").innerHTML = "Cannot predict now.";
  }
  if (randnum == 16) {
  document.getElementById("response").setAttribute("class", "green");
  document.getElementById("response").innerHTML = "Most likely.";
  }
  if (randnum == 17) {
  document.getElementById("response").setAttribute("class", "yellow");
  document.getElementById("response").innerHTML = "Ask again later.";
  }
  if (randnum == 18) {
  document.getElementById("response").setAttribute("class", "red");
  document.getElementById("response").innerHTML = "My reply is no.";
  }
  if (randnum == 19) {
  document.getElementById("response").setAttribute("class", "green");
  document.getElementById("response").innerHTML = "Outlook good.";
  }
  if (randnum == 20) {
  document.getElementById("response").setAttribute("class", "yellow");
  document.getElementById("response").innerHTML = "Don\'t count on it.";
  }
  &lt;/script&gt;
  </code></pre>