.document引用到是的 iframe所在页面对象,
.Document (大写D),才能引用到iframe内含对象
<html>
<head>
<script>
function SetCwinHeight(obj)
{
// alert(obj.document.getElementById("tDiv").innerText);//可以获得当前页面id为tDiv的div的值
alert(obj.Document.all.tDiv.innerText);
//这个可以获得text.html里面id为tDiv的div的值、、、
}
</script>
</head>
<body>
<iframe src="test.html" onload="SetCwinHeight(this);" width="600px' id="myframe"
name="myframe">
</iframe>
<div id="tDiv">
tdiv
</div>
</body>
</html
>
test.html
...
<div id="tDiv" name="tDiv">sdiv</div>
...
下面是兼容ie,ff。chome等的写法
、
function SetCwinHeight()
{
var obj=document.getElementsByTagName("iframe")[0];
// var obj2=document.getElementById("myframe");//chome和firefox不支持id取iframe
//alert(obj2);
var str="";
var cwin=obj;
var sobj=null;
if (document.getElementById){
if (cwin && !window.opera){
if (cwin.contentDocument){
sobj = cwin.contentDocument; //FF NS
alert("ff or chome");
}
else if(cwin.Document){
sobj = cwin.Document;//IE
alert("ie");
}
}
else{
if(cwin.contentWindow.document){
sobj = cwin.contentWindow.document;//Opera
alert("opera ");
}
}
}
for(i in sobj){
str+=i+"<br/>";
}
document.write(str);
}
另外iframe.Doucment的属性还有
引用
namespaces
lastModified
parentNode
nodeType
fileCreatedDate
onbeforeeditfocus
bgColor
oncontextmenu
onrowexit
embeds
scripts
onactivate
mimeType
alinkColor
onmousemove
onselectstart
oncontrolselect
body
protocol
onkeypress
onrowenter
onmousedown
vlinkColor
URL
onreadystatechange
doctype
onbeforedeactivate
applets
fileModifiedDate
onmouseover
dir
media
defaultCharset
firstChild
plugins
onafterupdate
ondragstart
oncellchange
cookie
documentElement
nextSibling
nameProp
referrer
ondatasetcomplete
onmousewheel
onerrorupdate
onselectionchange
lastChild
ondblclick
onkeyup
location
forms
title
onrowsinserted
previousSibling
compatMode
onmouseup
onkeydown
onrowsdelete
onfocusout
fgColor
ondatasetchanged
onmouseout
parentWindow
nodeName
onpropertychange
onstop
onhelp
linkColor
onbeforeactivate
images
readyState
frames
all
onbeforeupdate
onclick
childNodes
onfocusin
anchors
selection
fileUpdatedDate
domain
security
fileSize
ownerDocument
ondataavailable
styleSheets
nodeValue
attributes
activeElement
implementation
links
URLUnencoded
ondeactivate
分享到:
相关推荐
获取iframe的document对象的目的就是进行dom的操作 $(function() { var result = $('#myframe').prop('contentWindow').document; console.log(result); }); 这样输出来的结果是:document对象
iframe.document出现拒绝访问。 threw an exception of type 'System.UnauthorizedAccessException' dynamic {System.UnauthorizedAccessException}
属性名和属性值一致的时候,可以省略属性值5、iframe框架 6、浏览: chrome,谷歌 百度浏览器 7、html编程:语义化 8、标签上的属性: 属性名和属性值一致的时候,可以省略属性值5、iframe框架 6、浏览: ...
iframe自适应高度兼容各主流浏览器,经本人亲手测试。 通过测试的浏览器:IE/Firefox/Chrome/Opera/Safari 注:此方法不支持DOM动态操作 版本太旧,自行选择
iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe...
iframe高度自适应,多浏览器兼容 已测试过在ie6,7,8,firefox8,chrom15中通过
之前在IE遇到过设置不了iframe的name属性 JavaScript代码 var iframe = document.createElement('iframe'); iframe.name = 'ifr'; //iframe.setAttribute('name', 'ifr'); //这样也不行 上面两种方式都无法设置。...
主要介绍了jquery得到iframe src属性值的方法,很简单,很实用,需要的朋友可以参考下
这个库允许的高度与同跨域iframe来适应他们所...在iframe页面链接修复和支持iFrame与父页面之间的链接。 提供自定义的大小和滚动方法。 使家长地位和视口大小的iframe。 与ViewerJS支持PDF和ODF文档。 后备支持到IE8。
iframe自适应高度(兼容目前所有主浏览器)
iframe自适应高度(兼容多种浏览器) 亲测可以
iframe自适应高度和宽度
document是window的一个对象属性。 Window 对象表示浏览器中打开的窗口。 如果文档包含框架(frame 或 iframe 标签),浏览器会为 HTML 文档创建一个 window 对象,并为每个框架创建一个额外的 window 对象。 所有的...
iframe_常用属性知识.txt
nw.js-iframe-浏览器NW.JS 带有一个工具栏,该工具栏具有一些浏览器功能。 但是,如果您想自定义 UI 并将节点脚本与网站分开怎么办? 我已经将这个项目提炼成一个简单的浏览器,以便尝试解决使用 iframe 制作浏览器...
IE方法:document.frames[‘myFrame’].document.getElementById(‘test’).value; 火狐方法:document.getElementById(‘myFrame’).contentWindow.document.getElementById(‘test’).value; IE、火狐方法: 代码...
1,iframe在没有指定宽和高时默认全屏的bug 2,当iframe隐藏时的错误显示效果 3,当iframe以tab标签的方式显示时,由于tab标签切换执行也需要一段时间,造成的获取的iframe的高和宽不是最终的高和宽 4,其他细微调整...
就想弄一个winform结合html5的一个小东西,突有心血来潮,想在里面嵌套一个微信网页版,下面小编给大家介绍下HTML阻止iframe跳转页面并使用iframe在页面内嵌微信网页版的实现方法,一起看看吧