版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u012507347/article/details/48391841
iframe
- 主页面获得iframe的方法
- iframe获得主页面的方法
1.主页面获得iframe的方法
<iframe name="myiframe" src="test.html">
根据name获得,得到的是iframe的window对象
console.log(myiframe);
打印出来是
Window {top: Window, location: Location, document: document, window: Window, external: Object…}
2.iframe获得主页面的方法
var main = window.parent;
同样得到的是主页面的window对象
在 HTML 5 中,仅仅支持 src 属性