访问iframe中的frameset元素 [英] Accessing frameset element inside iframe

查看:94
本文介绍了访问iframe中的frameset元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试访问框架集中的frame src属性.但是document.getElementById('cntvars').firstChild为null.如何进入子元素?

I'm trying to access frame src attribute inside a frameset. But document.getElementById('cntvars').firstChild is null. How do I step into the child elements?

<iframe id="cntvars" onload="prstofrm();" src="http://sites.google.com" style="display:none"></iframe>
    <html>
        <head></head>
            <frameset rows="100%,*" border="0">
                <frame src="http://sites.google.com?qty=13.00&amp;sub=7.24&amp;shp=0.00&amp;dis=0.00&amp;vch=0.00&amp;tax=0.00&amp;tot=7.24&amp;sd=" frameborder="0">
                <frame frameborder="0" noresize="">
            </frameset>
            <!-- pageok -->
            <!-- 04 -->
            <!-- -->
    </html>
</iframe>

推荐答案

您不能(除非您在Google工作并为sites.google.com编写代码,但我认为不是).同源策略可防止父页面查看"存储在其他域中的框架的内容.

You can't (unless you're working at Google and writing code for sites.google.com, which I assume you aren't). The same-origin policy prevents the parent page from "looking at" the contents of frames which are stored on other domains.

这篇关于访问iframe中的frameset元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆