中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

Frame/IFrame contentDocument 屬性

Frame/IFrame 對(duì)象參考手冊(cè) Frame/IFrame 對(duì)象

定義和用法

contentDocument 屬性以 HTML 對(duì)象返回框架容納的文檔。

可以通過(guò)所有標(biāo)準(zhǔn)的 DOM 方法來(lái)處理被返回的對(duì)象。

注意:由于安全原因,文檔的內(nèi)容只能通過(guò)同一個(gè)域名下的另外一個(gè)文檔訪問(wèn)。

語(yǔ)法

frameObject.contentDocument

或者

iframeObject.contentDocument

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持 contentDocument 屬性

注意:如果指定了 !DOCTYPE, Internet Explorer 8 及更高版本支持 contentDocument 屬性,其他IE版本請(qǐng)使用 contentWindow 屬性。


實(shí)例

實(shí)例

通過(guò)瀏覽器實(shí)例展示了如何在修改iframe中文檔的背景顏色:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>小白教程(json.cn)</title>
<script>
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>你的瀏覽器不支持iframes。</p>
</iframe>
<br><br>
<input type="button" onclick="changeStyle()" value="修改背景顏色">

</body>
</html>

運(yùn)行代碼 ?

Frame/IFrame 對(duì)象參考手冊(cè) Frame/IFrame 對(duì)象其他擴(kuò)展