title: Getting Value From Popup Window Using only JS & HTML
body: <p>Is it possible to get a value from a popup window? Additionally I would like to use JS and HTML only, i.e. no PHP. Is this even possible? I've seen other posts on here like this one:</p>
  
  <p><a href="https://stackoverflow.com/questions/9919857/getting-value-from-popup-window">getting value from popup window</a></p>
  
  <p>but that's in aspx.</p>
  
  <p>I have googled a bit and found this link:</p>
  
  <p><a href="http://www.bignosebird.com/js/popmap.shtml" rel="nofollow noreferrer">http://www.bignosebird.com/js/popmap.shtml</a></p>
  
  <p>However, it works on that guys site but not when i copy and paste it, I may be a noob so this is what I have:</p>
  
  <p><strong>parent.html</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form&gt;
  &lt;INPUT TYPE="TEXT" NAME="maparea" SIZE=2 VALUE=""&gt;
  &lt;input type=button onClick='targetitem = document.forms[0].maparea; dataitem = window.open("map.shtml", "dataitem", "toolbar=no,menubar=no,scrollbars=yes"); dataitem.targetitem = targetitem' value="Show Map"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>map.shtml</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script&gt;
  function select_item(item)
  {
  targetitem.value=item;
  top.close();
  return false;
  }
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;CENTER&gt;
  &lt;B&gt;Our Map&lt;/B&gt;
  &lt;BR&gt;
  
  &lt;IMAGE SRC="map1.gif" ISMAP USEMAP="#MAP1"&gt;
  &lt;MAP NAME="MAP1"&gt;
  &lt;AREA SHAPE=RECT COORDS="11,10,116,133" HREF="" onClick='return select_item("1")'&gt;
  &lt;AREA SHAPE=RECT COORDS="121,11,227,172" HREF="" onClick='return select_item("2")'&gt;
  &lt;AREA SHAPE=RECT COORDS="11,140,115,226" HREF="" onClick='return select_item("3")'&gt;
  &lt;AREA SHAPE=RECT COORDS="119,177,225,227" HREF="" onClick='return select_item("4")'&gt;
  &lt;AREA SHAPE=default HREF="" &gt;
  &lt;/MAP&gt;
  &lt;/CENTER&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>