I dont access the tag img inside iFrame

I dont access the tag img inside iFrame

Hi all.

I use this code for insert iframe in a specific div when I click  in a button:
$("#MyDiv").html("<iframe id='MyIframe' name='MyIframe' src='http://meusite/body.html' width=' 1023' height='575' frameborder='0'></iframe>");  

Its function correctly.

This body.html contains an javascript that insert in other specific div, one image.

I created other button for when I click, I get this img in my body.html inside this iframe.

But I dont access anything. My html() is empty, but in browser my code is like this:


My code for page that contains buttons is:
<html><head>

<meta charset="utf-8">
<title>Trocando SRC do Iframe</title>

<link href="estilos.css" rel="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-latest.js"></script>

</head>
<body>

<button id="button_body">Body</button>
<button id="button_chassy">Chassy</button>

<script>
$("#button_body").click(function () 
{
     
$("#MyDiv").html("<iframe id='MyIframe' name='MyIframe' src='http://meusite/body.html' width=' 1023' height='575' frameborder='0'></iframe>");  
})
 
$("#button_pega").click(function () 
{
      var tFrame = document.getElementById('teste1');
var ibody = tFrame.getElementsByTagName('div').length
 alert(ibody);
 
})


</script>

<div id="KeyShotVR"><iframe id="teste1" name="nomeIframe" src="http://perpendicular.tk/teste/body.html" width=" 1023" height="575" frameborder="0"></iframe></div>
<div id="KeyShotVR_Overlay"></div>


</body></html>

I need to get the src value in img tag in a red line in above image.

sds