【发布时间】:2011-12-09 21:27:12
【问题描述】:
我的 html 页面中有一个 iframe,我想从这个 iframe 中打开的页面访问一些内容。
<table border="1" width="100%" height="100%">
<tr>
<td id = "freebase_td">
<iframe id = "freebase_frame" src="http://www.freebase.com/view/en/angelina_jolie" width="100%" height="400px"></iframe>
</td>
</tr>
</table>
在此网页的源代码中,
<h1 id="page-title">
Angelina Jolie
</h1>
我想使用 javascript 访问 id 为“page-title”的 h1 标记中的内容。有可能吗?
【问题讨论】:
-
页面是否位于两个不同的域中?那么,上面的页面和http://www.freebase.com/view/en/angelina_jolie?
-
你不能。谷歌“同源政策”看看为什么。
标签: javascript html dom iframe