title: js iframe close button
body: <p>I Have the following which opens an iframe with html page loaded, works great, but how to add a close button to the page/iframe so it simply closes the iframe/page and does not affect the page its opened over:</p>
  
  <pre><code>(function (d) {
  var modal = document.createElement('iframe');
  modal.setAttribute('src', 'mypage.html'));
  modal.setAttribute('scrolling', 'no');
  modal.className = 'modal';document.body.appendChild(modal);
  var c = document.createElement('link');
  c.type = 'text/css';
  c.rel = 'stylesheet';
  c.href = '//myurl.com/testes.css';
  document.body.appendChild(c);
  }(document));
  </code></pre>
  
  <p>I tried the following which tried to close it, but, then gives a 404 message inside the iframe:</p>
  
  <pre><code>&lt;a href="window.parent.document.getElementById('iframe').parentNode.removeChild(window.parent.document.getElementById('iframe'))"&gt;Close&lt;/a&gt;
  </code></pre>
  
  <p>I am loading jquery on the page if that helps at all, meaning, if there is a jquery solution.</p>