我有一个iFrame,其内容在另一个iFrame中.我想获得内部iFrame的src内容.我怎么能用javascript做到这一点?
外页:
<html>
<body>
<iframe id="ifr1" src="page1.htm"></iframe>
<iframe id="ifr2" src="http://www.google.com"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
page1.htm:
<html>
<body>
<script type="text/javascript">
document.write(parent.document.getElementById('ifr2').src);
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
46782 次 |
| 最近记录: |