title: easy javascript code not working
body: <p>I have a problem with the following code. I'm trying to get a random string from my array to be displayed when a button is clicked.</p>
  
  <pre><code>&lt;script&gt;
      var button = document.getElementById("button");
      var div = document.getElementById("box");
      var text = document.getElementById("text");
      var array=[ "thanks for clicking", "keep on clicking", "click one more time", "why do you keep on clicking me?", "stop clicking me!"];
  function thing(){
      var y = array[Math.floor((Math.random() * array.length)+1)];
      text.value=y;
  }
  
  function what(){
      text.value = "what";    
  }
  &lt;/script&gt;
  &lt;body&gt;
  &lt;form&gt;
  &lt;input type="button" id="button" value="click" onClick="what()" /&gt;
  &lt;/form&gt;
  &lt;form&gt;
      &lt;input type="text" id="text" value="hey" /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>