contentwindow & contentdocument
来源:互联网 发布:汇智通数据录入挣钱吗 编辑:程序博客网 时间:2024/05/05 23:39
contentDocument
Definition and Usage:
The contentDocument property returns the Document object generated by a frame or iframe element.
This property can be used in the host window to access the Document object that belongs to a frame or iframe element.
Note: Because of security reasons, the contents of a document can be accessed from another document only if the two documents are located in the same domain.
Syntax:
frameObject.contentDocument or iframeObject.contentDocument
eg:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript">
function changeStyle()
{
var x=document.getElementById("myframe");
var y=(x.contentWindow || x.contentDocument);
if (y.document)y=y.document;
y.body.style.backgroundColor="#0000ff";
}
</script>
</head>
<body>
<iframe id="myframe" src="demo_iframe.htm">
<p>Your browser does not support iframes.</p>
</iframe>
<br /><br />
<input type="button" onclick="changeStyle()" value="Change background color" />
</body>
</html>
contentWindow
Definition and Usage:
The contentWindow property returns the Window object generated by a frame or iframe element (through the window object, you can access the document object and then any one of the document's elements).
Syntax:
frameObject.contentWindow or iframeObject.contentWindow
- contentwindow & contentdocument
- IFRAMEs, .contentWindow, .contentDocument区别
- 关于 contentWindow, contentDocument
- contentWindow 和 contentDocument
- 关于 contentWindow, contentDocument
- 关于 contentWindow, contentDocument
- 关于 contentWindow, contentDocument
- 关于iframe中的contentWindow, contentDocument
- contentWindow 和contentDocument区别 及iframe访问
- contentwindow 和contentdocument dom对象和jquery对象
- JS操作iframe里的DOM || contentWindow,contentDocument
- 各浏览器Iframe对contentWindow、contentDocument、document及frames属性测试
- 各浏览器Iframe对contentWindow、contentDocument、document及frames属性测试
- iframe.contentWindow
- 框架的contentDocument支持问题
- iframe的 contentWindow属性
- FrameTab的contentWindow
- contentWindow的使用
- EL & JSTL
- 【Github】Github+Jekyll搭建个人博客
- HDU
- SSH包全解
- C++11 并发指南
- contentwindow & contentdocument
- 继承
- 关于Myeclipse configuration center中software中的personal sites中添加的插件无法删除
- 浅谈Java中的equals和==
- springboot(八):RabbitMQ详解
- ETL利器Kettle实战应用解析系列二 【应用场景和实战DEMO下载】
- 数组元素循环右移问题(C语言解决)
- jsp页面equal symbol expected错误
- Leap Motion 之 Base Class