title: How to reference an id from external js file
body: <p>This is a followup question.  I finally was able to get the prompt loop to work in the js function.  but I would like for it to show the answers (vars) that are inputted back on the main html.  I created a container for the list and then created <code>&lt;p&gt;</code> ids so that I could use </p>
  
  <pre><code>document.getElementById('emp'+loopct).innerHTML=inName;  
  </code></pre>
  
  <p>to show the item in the browser. But it seems that "document" does not reference the html document (I notice the browser is dimmed in the background).  I will include the html and then the external script.</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/payroll.css" /&gt;
  
  &lt;title&gt;Payroll System&lt;/title&gt;
  
  
  &lt;script type="text/javascript" &gt;
  var emps = new Array();
  &lt;/script&gt;   
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Jackson Payroll System&lt;/h1&gt;
  
  &lt;button type="button" onclick="inputEmp()"&gt;Click here to enter employees&lt;/button&gt;
  
  &lt;div class="empContainer"&gt;
  &lt;p id=emp0&gt; &lt;/p&gt;
  &lt;p id=emp1&gt; &lt;/p&gt;
  &lt;p id=emp2&gt; &lt;/p&gt;
  &lt;p id=emp3&gt; &lt;/p&gt;
  &lt;p id=emp4&gt; &lt;/p&gt;
  &lt;p id=emp5&gt; &lt;/p&gt;
  &lt;p id=emp6&gt; &lt;/p&gt;
  &lt;p id=emp7&gt; &lt;/p&gt;
  &lt;p id=emp8&gt; &lt;/p&gt;
  &lt;p id=emp9&gt; &lt;/p&gt;
  &lt;p id=emp10&gt; &lt;/p&gt;
  &lt;p id=emp11&gt; &lt;/p&gt;
  &lt;p id=emp12&gt; &lt;/p&gt;
  &lt;p id=emp13&gt; &lt;/p&gt;
  &lt;p id=emp14&gt; &lt;/p&gt;
  &lt;p id=emp15&gt; &lt;/p&gt;
  &lt;p id=emp16&gt; &lt;/p&gt;
  &lt;p id=emp17&gt; &lt;/p&gt;
  &lt;p id=emp18&gt; &lt;/p&gt;
  &lt;p id=emp19&gt; &lt;/p&gt;
  &lt;p id=emp20&gt; &lt;/p&gt;
  &lt;/div&gt;
  &lt;script type="text/javascript" src="scripts/payroll.js"&gt;&lt;/script&gt; 
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  
  function inputEmp() {
  var inName = "";
  var loopCt = 0
  var tArray = new Array();
  
  while (inName != "-1") 
  {
      inName = prompt("Please enter your name (enter -1 to finish)","Employee Name");
  if (inName == "-1")  { break; }
  if (inName==null || inName=="")
      {
      alert("Blank names are not allowed.  To exit enter '-1'.");
      } 
  else
      tArray[loopCt++] = inName;
      document.getElementById('emp'+loopct).innerHTML=inName;
  {
  
  }
  }
  return tArray;
  }   
  </code></pre>