title: Get an element inside an iframe with javascript
body: <p>how to get Element From an Iframe?
  i want when the attribute of an element that its in a frame is true;
  it show a text, and else show another text;
  (sorry for bad english!)</p>
  
  <p>like that:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
      &lt;html&gt;
  
      &lt;head&gt;
      &lt;title&gt;document&lt;/title&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
  
      &lt;iframe id="frame" src=""&gt;
  
      &lt;!--we think in frame there is a span tag with button id--&gt;
      &lt;span id="button" aria-passed="true"&gt;sss&lt;/span&gt;
      &lt;/iframe&gt;
      &lt;br&gt;
  
      &lt;!--if its true--&gt;
      &lt;p id="content1" style="display:none;"&gt;
      true
      &lt;/p&gt;
      &lt;!--if its false--&gt;
      &lt;p id="content2" style="display:none;"&gt;
      false
      &lt;/p&gt;
  
      &lt;!--now we want that, if aria-passed=true show content1 else content2.--&gt;
      &lt;script type="text/javascript"&gt;
      var Frame = document.getElementById('frame');
      if(new RegExp ("true","gim").test(frame.contentWindow.document.getElementById('button').aria-passed="true") == true) {
       document.getElementById('content1').style.display="block";
      }
      else {
       document.getElementById('content2').style.display="block";
       }
      &lt;/script&gt;
      &lt;/body&gt;
  
      &lt;/html&gt;
  </code></pre>
  
  <p>now i want to say why this code does not work????
  any ideas?</p>