title: Javascript document write button inside function used by another function not working
body: <p>Just for fun I'm trying to make a small game with javascript, I'm pretty new to programming so this was more of a test of what i could do.    </p>
  
  <p>I have the following inside of a function that happens when i press a button, this does correctly make the new button appear but It won't reconize the function below it when pressing this new button</p>
  
  <pre><code>function clickStart(){
  document.write("&lt;input type='button' value='attack!' onClick='clickAttack();' /");
  </code></pre>
  
  <p>The other Function looks like this</p>
  
  <pre><code>function clickAttack(){
      if(heroHealth &gt;= 0 &amp;&amp; monsterHealth &gt;= 0){
  </code></pre>
  
  <p>This function is right after closing the first one.</p>
  
  <p>The Console gives me the following</p>
  
  <pre><code>ReferenceError: clickAttack is not defined
  </code></pre>
  
  <p>I'm not sure how i could fix this.</p>
  
  <p>Help will be appriciated</p>