title: How to check that a frame of frameset exists
body: <p>I have a frameset that has 3 frames:</p>
  
  <pre><code> &lt;frameset rows="124, *, 0"&gt;
      &lt;frame id="f1" scrolling="No" frameborder="0" src="" name="control"&gt;
      &lt;frame id="f2" frameborder="0" src="" name="main"&gt;
      &lt;frame id="f3" noresize frameborder="0" name="go"&gt;
  &lt;/frameset&gt;
  </code></pre>
  
  <p>I'm going to check if frame with id = "f2" exist?</p>
  
  <p>I have tried : </p>
  
  <pre><code>&lt;script&gt;
  if( document.getElementById("f2").contentDocument.documentElement.innerHTML !== null) {
  alert('ok');
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>But not worked.
  I know i should do something like:</p>
  
  <pre><code>document.getElementById("f2")
  </code></pre>
  
  <p>but need more info</p>