如何在iframe旁边设置背景颜色 [英] how to set background color out side the iframe

查看:109
本文介绍了如何在iframe旁边设置背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我正在尝试更改html页面的backgroundcolor,但它只更改js中的iframe颜色我应该做什么代码?

hi I am trying to change the backgroundcolor of html page but it is changing only the iframe color in js what code should I do?

推荐答案

使用窗口。父级访问iframe的父级,从那里你可以通过代码正常改变css



http://stackoverflow.com/questions/935127/how-to-access-parent-iframe-from-javascript [ ^ ]



请注意,这仅适用于iframe的源来自与父级相同的site \ domain。出于安全原因,从其他域嵌入的任何iframe都无法访问父级。
Use window.parent to access the iframe's parent, and from there you can alter the css as normal via code

http://stackoverflow.com/questions/935127/how-to-access-parent-iframe-from-javascript[^]

Note this will only work if the source of the iframe comes from the same site\domain as the parent. Any iframe that has been embedded from a different domain can't access the parent for security reasons.


这篇关于如何在iframe旁边设置背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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