title: How to change the iframe's component's value right after the iframe src change?
body: <p>Initially the iframe src is 3.html and it doesnt has the element which id is 'p', and I want to change the iframe src to 2.html and change the 'p' element value to 11. But it didn`t work. Could anyone give some solution?</p>
  
  <p>What i want to do is simple in one event:</p>
  
  <p>1)change the iframe src.</p>
  
  <p>2)change the iframe's element's value.</p>
  
  <p>1.html</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function testIframe()
  {
  test1();
  test2();
  
  }
  function test1()
  {
  document.frames('myFrame').src='2.html';
  }
  function test2()
  {
  document.frames('myFrame').document.getElementById('p').innerHTML='11';
  }
  &lt;/script&gt;
  &lt;body&gt;
  &lt;input type="submit" id="button" onClick="testIframe()" value="ok"&gt;
  &lt;iframe name="myIFrame" id="myFrame" src="3.html"&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>2.html</p>
  
  <pre><code>&lt;body&gt;
  &lt;p id="p"&gt;33&lt;/p&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>3.html</p>
  
  <pre><code>&lt;body&gt;
  &lt;/body&gt;
  </code></pre>