title: Using Javascript to replace Text in HTML tag with innerHTML and functions
body: <p>I'm trying to change the text inside a h1 tag using the element id "greeting" and a external java script. I'm having trouble trying to figure out how to call upon my function init that has gathered variables and use them in the next function. Heres what I have so far.</p>
  
  <p>HTML
       
       </p>
  
  <pre><code> &lt;head&gt;
  
      &lt;title&gt;Matt Beckley&lt;/title&gt;
      &lt;script type="text/javascript" src="script1.js"&gt;&lt;/script&gt;
  &lt;/head&gt; 
  
  &lt;body&gt;
  
   &lt;h1 id="greeting"&gt;Welcome!&lt;/h1&gt;
  
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>THE SCRIPT WHERE THE PROBLEM IS!</p>
  
  <pre><code> window.onload = init;
  
   function init() 
   {
   var fullname=prompt("Please Enter you name!","Anonymous ");
  (fullname == "Anonymous")? "Anonymous " : "";
  
   var nickname=prompt("Please Enter you nickname!"," None");
   (nickname == "None")? " None": ""; 
   }
  
   function writeGreeting()
   {
      document.getElementById("greeting").innerHTML= ?????????
   }
  </code></pre>
  
  <p>So I don't know how to make the last function work so that the h1 tag shows a name and a nick. w3schools only shows "Strings" and not the ability to call the other function. Anyone know how to do this?</p>