请教问题:我在HTML页面中用iframe 嵌套一个mht网页,问题出现:mht内容如果超长,如何取消iframe的滚动条,或者如何读取出mhm网页的高度 http://community.csdn.net/Expert/topic/4701/4701209.xml?temp=.651333 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 --------------mht.htm-----------<script>function Load(){ window.frameElement.height = screen.height}</script><body onload="Load()" 抱歉,笔误.<script>function Load(){ window.frameElement.height = document.body.scrollHeight + 50}</script><body onload="Load()">.... 设置iframe的scrolling属性为false 说错了,是no不是false<iframe scrolling="no"></iframe> 多谢各位!***********************************************************************************TO:xishanlang2001(西山狼2000) 兄弟 如果不在mht文件中添加脚,全部改在父层控,如何实现,谢谢。***********************************************************************************TO:wideroad() 兄弟:你所说的方法不可行,因为如此取消了滚动条显示,但内容显示不全了。谢谢-----------------------------------------------------------------------------------TO:Taciterry(面朝大海,春暖花开)兄弟 这种方法不适用于htm 与mht方式,还是多谢! 跟你们学坏了,:) 我也写错了!TO:xishanlang2001(西山狼2000) 兄弟 如果不在mht文件中添加脚本,全部改在父层控制,如何实现,谢谢。 那就这样好了.iframe onreadystatechange="if( this.onreadystatechange == 'loaded' )..."大概思路是这样的吧. <html><script>function test(the){ if( the.readyState == "complete" ) { the.height = the.contentWindow.document.body.scrollHeight + 50 ;//ie6 only /*ie5 user:*/ //window.frames[ the.id ].document.body.scrollHeight + 50 ;//ie6 only }}</script><body><iframe id="aa" name="aa" src="2.htm" onreadystatechange="test(this)" ></iframe></body></html> TO ::xishanlang2001(西山狼2000)哥们 问题已解决,其方法在原来基础上修如下。页面在加载的时候存在延时,没有找到相应的事件,所以就加了一个settimeout。 上面你新介绍的方法存在ie版本问题,所以采用时还需斟酌。不过还是万分的感谢于你。看来哥们你很强呀,学习!!!!----------------------------------------------------------<html><head><title>page</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><link href="css.css" rel="stylesheet" type="text/css"><body bgcolor="#E2FEBC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" load="changewin()"> <iframe scrolling="no" frameborder="0" height="" width="100%" src="Xml.mht" id="infobody" ></iframe> </body></html><SCRIPT FOR=window EVENT=onload LANGUAGE="JScript">//alert("onload");changewin()function changewin(){if (infobody.document.body.scrollHeight){ document.all("infobody").height=infobody.document.body.scrollHeight; } else { settimeout("changewin()",500); }}</SCRIPT> 又看了一下你关于iframe高度自适应的那个问题,和你最后的解决方案.发现了一点点问题,因为递归而未被结束,所以页面会每半秒执行一次操作,即执行 document.all("infobody").height=infobody.document.body.scrollHeight;这样的话,你不如调整一下,改成这样:var theID = setInterval( changewin , 500 )function changewin(){ if (infobody.document.body.scrollHeight) { document.all("infobody").height=infobody.document.body.scrollHeight; clearInterval( theID ) }} 消息: 对象不支持此属性或方法 IE兼容性问题 IE9Firefox document.getElementById().value 的值为undefined jquery 获取拥有某个样式的li的id backspace键 高手帮忙写个JS验证表单!谢谢啊. JavaScript 正则表达式 验证网址 js如何判断字符串是否包含某些特定的中文字符 java script 不响应 免费发布一个日期选择控件的HTC代码 求助:有关tr或其它tag的disabled属性 求救,<label>的问题? 仿google suggest是遇到的问题
<script>
function Load()
{
window.frameElement.height = screen.height
}
</script>
<body onload="Load()"
function Load()
{
window.frameElement.height = document.body.scrollHeight + 50
}
</script><body onload="Load()">
....
***********************************************************************************
TO:xishanlang2001(西山狼2000) 兄弟
如果不在mht文件中添加脚,全部改在父层控,如何实现,谢谢。
***********************************************************************************TO:wideroad() 兄弟:你所说的方法不可行,因为如此取消了滚动条显示,但内容显示不全了。谢谢
-----------------------------------------------------------------------------------
TO:Taciterry(面朝大海,春暖花开)兄弟
这种方法不适用于htm 与mht方式,还是多谢!
TO:xishanlang2001(西山狼2000) 兄弟
如果不在mht文件中添加脚本,全部改在父层控制,如何实现,谢谢。
iframe onreadystatechange="if( this.onreadystatechange == 'loaded' )..."大概思路是这样的吧.
<script>
function test(the)
{
if( the.readyState == "complete" )
{
the.height = the.contentWindow.document.body.scrollHeight + 50 ;//ie6 only
/*ie5 user:*/
//window.frames[ the.id ].document.body.scrollHeight + 50 ;//ie6 only
}
}
</script>
<body>
<iframe id="aa" name="aa" src="2.htm" onreadystatechange="test(this)" ></iframe>
</body>
</html>
上面你新介绍的方法存在ie版本问题,所以采用时还需斟酌。不过还是万分的感谢于你。看来哥们你很强呀,学习!!!!----------------------------------------------------------
<html>
<head>
<title>page</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css.css" rel="stylesheet" type="text/css"><body bgcolor="#E2FEBC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" load="changewin()">
<iframe scrolling="no" frameborder="0" height="" width="100%" src="Xml.mht" id="infobody" ></iframe>
</body>
</html>
<SCRIPT FOR=window EVENT=onload LANGUAGE="JScript">
//alert("onload");
changewin()
function changewin(){
if (infobody.document.body.scrollHeight){
document.all("infobody").height=infobody.document.body.scrollHeight;
}
else
{
settimeout("changewin()",500);
}
}</SCRIPT>
发现了一点点问题,因为递归而未被结束,所以页面会每半秒执行一次操作,即执行
document.all("infobody").height=infobody.document.body.scrollHeight;这样的话,你不如调整一下,改成这样:
var theID = setInterval( changewin , 500 )function changewin()
{
if (infobody.document.body.scrollHeight)
{
document.all("infobody").height=infobody.document.body.scrollHeight;
clearInterval( theID )
}
}