
那你可以在mainaspx初始化写上这样一句
function screeChange(){
windowparentdocumentgetElementById('rightFrame')rows="50,"+documentbodyscrollHeight+",100";
}
</script>
body里面加上:onload="screeChange()"
注意一定要在body里面或者它的后面初始化,不然获取不到内容高度。
其中documentbodyscrollHeight获取mainaspx页面的实际文本高度,然后赋值给它的父窗体中的rightFrame的row值。。。
另外:<frame src="bottomhtm" id="bottomFrame" name="mainFrame" frameborder="0" scrolling="no" >
这个name值是不是写错鸟。。。。
另外在aspnet编程中。。。建议舍弃frameset 使用irame哈。。
这种方法是对的,不过前提是:你必须有足够权限访问 iframe Docuemnt —— 同域
例如,indexhtml 和 my_framehtml 都在同一域名下,或都在桌面,这样可以
但如果你把 iframe 的 src 换为百度网址,就会出现类似下面的错误
Permission denied to access property 'getElementById'
无权访问 'getElementById' 属性
如果你的情况是后者,那就没有解决办法。如果是前者,可能你的代码中有错误。
<iframe src='insur_shorthtml' id='rev_age' onload='showheight();'></iframe>
<script language=javascript>
function showheight(){
alert(rev_agewindowdocumentbodyscrollHeight)
}
</script>
请在IE或火狐下调试以下代码,由于Chrome(谷歌)的iframe机制,不能在本地运行和iframe相关的js,需要架设到服务器或IIS上才有效果。
<script>windowonload = function(){
var height = windowframes["if"]documentbodyscrollHeight;
alert(height);
};
</script>
<iframe id="if" src="1html"></iframe>
下面是关于高度自适应内容的。
可以用jq控制 在 加iframe的页面中加
$("#iframe的ID")load(function () {
var mainheight = $(this)contents()find("body")height() + 30;
$(this)height(mainheight);
});
iframe链接的页面中加
$(windowparentdocument)find("#iframe的ID")load(function () {
var main = $(windowparentdocument)find("#iframe的ID");
var thisheight = $(document)height() + 30;
mainheight(thisheight);
});
以上就是关于如果iframe的子页面是一个frameset框架文件怎么获取frameset的内容高度全部的内容,包括:如果iframe的子页面是一个frameset框架文件怎么获取frameset的内容高度、如何获取页面iframe元素内容的高、宽、js 怎么判断iframe嵌入页面的总高度 即滚动条所能滚动的高度等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)