日期:2014-05-16  浏览次数:20383 次

如何获取div中的iframe

<div>
  <div style="width: 1058px; display: block; height: 480px;"><iframe>3</iframe></div>
  <div style="width: 1058px; display: block; height: 480px;"><iframe>5</iframe></div>
  <div style="width: 1058px; display: none; height: 480px;"><iframe>78</iframe></div>
  <div style="width: 1058px; display: block; height: 480px;"><iframe>7</iframe></div>
</div>


如何获取第三个iframe的src

------解决方案--------------------
JScript code
alert(document.getElementsByTagName('div')[2].getElementsByTagName('iframe')[0].src);

------解决方案--------------------
document.getElementsByTagName('div')[2].getElementsByTagName('iframe')[0].src