Iframe不起作用
Iframe dosent work
我有代码:
<iframe src="in1.html" width="400" height="300" id="f1">
<p>Your browser does not support iframes.</p>
</iframe>
<script>
var childFrame = document.getElementById("f1").contentWindow;
childFrame.document.body.style.backgroundColor = "yellow"
</script>
当我加载页面黄色显示,但然后白色背景加载。为什么?
您必须等待iframe加载....
iframe src="in1.html" width="400" height="300" id="f1">
<p>Your browser does not support iframes.</p>
</iframe>
<script>
var childFrame = document.getElementById("f1");
childFrame.onload = function() {
var cWindow = childFrame.contentWindow;
cWindow.document.body.style.backgroundColor = "yellow";
}
</script>
相关文章:
- 从子级(iframe)到父级的跨域通信不起作用
- iframe中的jQuery查找元素不起作用
- 如果iframe在src(pdf或text)中有非html文档,则iframe中的onload不起作用
- iframe resizer内部的锚点链接不'不起作用
- 我需要一种自动调整iframe大小的方法,无论我查到什么,它都不起作用
- 占位符属性嵌入IE中的iframe时不起作用
- jQuery道具在iframe中不起作用
- Iframe加载动画不起作用
- 将IFrame滚动到顶部在Chrome中不起作用
- Iframe滚动溢出隐藏在css中不起作用
- iframe高度100%不起作用
- document.ready函数在iframe内不起作用
- 火狐浏览器 iframe 设计模式不起作用
- 插入内容后,Iframe 中的单击处理程序不起作用
- Cordova iframe在iOS Safari中工作,但在Android中不起作用
- 在 iFrame 中滚动事件侦听器在 iOS 上不起作用
- Javascript:在页面加载时打印iframe的内容不起作用
- 在第二次加载时更改 iframe 样式,在 Internet Explorer 9 中不起作用
- 为什么我的 iframe 标签不起作用
- PhoneGap中的postMessage不起作用-iframe到父消息