关于Ifream使用js使高度自适应的问题.请求帮助 http://blog.csdn.net/meizz/archive/2006/03/27/639857.aspx 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=gb2312'> <meta name='author' content='F.R.Huang(meizz梅花雪)//www.meizz.com'> <title>用 iframe 模拟 frame 使网架网页能够居中</title> </head> <body topmargin=0 leftmargin=0><center> <table border=0 width=780 height=100% cellspacing=0 cellpadding=0 align=center> <tr><td width=780 colspan=2 height=100> <iframe width=100% height=100% frameborder=1></iframe> </td></tr> <tr> <td width=180> <iframe width=100% height=100% frameborder=1></iframe> </td> <td width=600 valign=top><div style="height: 100%"> <iframe width=100% height=100% name="MzMain" frameborder=1 id="MzMain" src="用iframe模拟frame子页.htm"></iframe> </div></td> </tr> </table> </center></body></html> 用iframe模拟frame子页.htm <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=gb2312'> <meta name='author' content='F.R.Huang(meizz梅花雪)//www.meizz.com'> <title>iframe 自适应其加载的网页(多浏览器兼容)</title> <script language=javascript> function iframeAutoFit() //author: meizz(梅花雪 20041225) { if(self!=top && window.name=="MzMain") //这个 name 对应的是 iframe 的 name { var iframe = parent.document.getElementById(window.name); if(iframe) { iframe.parentNode.style.height = iframe.style.height; iframe.style.height = 10; var h = document.body.scrollHeight; var minimalHeight = parseInt((window.screen.width*11)/16, 10) - 280; h = h<minimalHeight ? minimalHeight : h; if(window.navigator.appName == "Microsoft Internet Explorer" && iframe.frameBorder=="1") h += 4; iframe.parentNode.style.height = iframe.style.height = h; } else alert("Iframe's id unequal to iframe's name!"); } } if(document.attachEvent) window.attachEvent("onload", iframeAutoFit); else window.addEventListener('load', iframeAutoFit, false); </script> </head> <body> <span style="width: 300; height: 400; background-color: yellow"> iframe 自适应其加载的网页(多浏览器兼容) </span> </body> </html>--MEIzz的 <iframe id=test name=p onload='reSizeFrame("test")' src="12312.html"></iframe>在12312.html中onload="parent.document.all.p.style.height=document.body.scrollHeight" 楼上的方法可行<iframe id=test name=p onload='reSizeFrame("test")' src="12312.html"></iframe>在12312.html中onload="parent.document.all.test.style.height=document.body.scrollHeight">==>不是document.all.p 楼上的方法可行<iframe id=test name=p onload='reSizeFrame("test")' src="12312.html"></iframe>在12312.html中onload="parent.document.all.test.style.height=document.body.scrollHeight">==>不是document.all.p------------------------------------------------------------------------------onload="parent.document.all('iframe名字').height=document.body.scrollHeight"也可以用JS12312.html加在页面最后<script language="Javascript">function doIt(){parent.document.all.yibo.style.height=document.body.scrollHeight;}onload=doIt</script>--b.html--<iframe name="p" scrolling="no" frameborder="0" src="12312.html"" marginwidth="0" marginheight="0" width=100%>注意:name="p"和parent.document.all."p".style.height=document.body.scrollHeight;要一致! 闲来无事,试验页面采用拖放进行传递数据的通用方法 求简单代码 散分,js中三种遍历数组的效率 菜鸟问题<A>和</A>之间的东西怎么引用 在JS里面我要把“abcd” 替换成 “1234” 怎么替换呀 怎么在打开一个页面的时候最大化,即把ie的地址栏,按钮栏什么的统统藏起来 下拉框问题 超级难,能把一个数组传到cookie中吗? (help me!!) 【高手请进,一道难题,用代码实现的给500分,我用我的人格担保!】llrock 怎么取出一个字符串左边的n个字符? 请教一个验证法则!谢谢! 在子窗口如何调用父窗口的JAVASCRIPT函数?
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<meta name='author' content='F.R.Huang(meizz梅花雪)//www.meizz.com'>
<title>用 iframe 模拟 frame 使网架网页能够居中</title>
</head>
<body topmargin=0 leftmargin=0><center>
<table border=0 width=780 height=100% cellspacing=0 cellpadding=0 align=center>
<tr><td width=780 colspan=2 height=100>
<iframe width=100% height=100% frameborder=1></iframe>
</td></tr>
<tr>
<td width=180>
<iframe width=100% height=100% frameborder=1></iframe>
</td>
<td width=600 valign=top><div style="height: 100%">
<iframe width=100% height=100% name="MzMain" frameborder=1
id="MzMain" src="用iframe模拟frame子页.htm"></iframe>
</div></td>
</tr>
</table>
</center></body></html>
用iframe模拟frame子页.htm
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<meta name='author' content='F.R.Huang(meizz梅花雪)//www.meizz.com'>
<title>iframe 自适应其加载的网页(多浏览器兼容)</title>
<script language=javascript>
function iframeAutoFit() //author: meizz(梅花雪 20041225)
{
if(self!=top && window.name=="MzMain") //这个 name 对应的是 iframe 的 name
{
var iframe = parent.document.getElementById(window.name);
if(iframe)
{
iframe.parentNode.style.height = iframe.style.height;
iframe.style.height = 10;
var h = document.body.scrollHeight;
var minimalHeight = parseInt((window.screen.width*11)/16, 10) - 280;
h = h<minimalHeight ? minimalHeight : h;
if(window.navigator.appName == "Microsoft Internet Explorer"
&& iframe.frameBorder=="1") h += 4;
iframe.parentNode.style.height = iframe.style.height = h;
}
else alert("Iframe's id unequal to iframe's name!");
}
}
if(document.attachEvent) window.attachEvent("onload", iframeAutoFit);
else window.addEventListener('load', iframeAutoFit, false);
</script>
</head>
<body>
<span style="width: 300; height: 400; background-color: yellow">
iframe 自适应其加载的网页(多浏览器兼容)
</span>
</body>
</html>
--
MEIzz的
onload="parent.document.all.p.style.height=document.body.scrollHeight"
<iframe id=test name=p onload='reSizeFrame("test")' src="12312.html"></iframe>
在12312.html中
onload="parent.document.all.test.style.height=document.body.scrollHeight">
==>不是document.all.p
<iframe id=test name=p onload='reSizeFrame("test")' src="12312.html"></iframe>
在12312.html中
onload="parent.document.all.test.style.height=document.body.scrollHeight">
==>不是document.all.p
------------------------------------------------------------------------------
onload="parent.document.all('iframe名字').height=document.body.scrollHeight"也可以用JS
12312.html
加在页面最后
<script language="Javascript">
function doIt()
{
parent.document.all.yibo.style.height=document.body.scrollHeight;
}
onload=doIt
</script>--b.html--
<iframe name="p" scrolling="no" frameborder="0" src="12312.html"" marginwidth="0" marginheight="0" width=100%>注意:name="p"和parent.document.all."p".style.height=document.body.scrollHeight;要一致!