title: JavaScript - PopUp Window With Text When Clicking List Items
body: <p>I'm trying to figure out what I'm missing with the script below. My goal is to have an ordered list (per assignment requirements), where a pop up window with text comes up when any of the list items are clicked. Each list item would lead to different text.</p>
  
  <p>I know there may be more efficient ways to do this, which are out of the scope of my understanding at this point, so I'm trying to do the following [non-working] work-around below.</p>
  
  <p>Example: When the user clicks the "One" list item, a pop up window should appear with the text inside it saying "Item 1", but I get "undefined" as a result. Any tips?</p>
  
  <p>My test HTML:</p>
  
  <pre><code>&lt;ol id="javaList" onclick="popUp()"&gt;
      &lt;li value="Item 1"&gt;One&lt;/li&gt;
      &lt;li value="Item 2"&gt;Two&lt;/li&gt;
      &lt;li value="Item 3"&gt;Three&lt;/li&gt;
  &lt;/ol&gt;
  </code></pre>
  
  <p>The JavaScript:</p>
  
  <pre><code>&lt;script&gt;
  
      window.popUp = function() {
          var myWindow = window.open("", "", "width=400, height=200");
          var ls = document.getElementsByTagName("li");
          myWindow.document.write(ls.value);
      }
  
  &lt;/script&gt; 
  </code></pre>