http://expert.csdn.net/Expert/topic/2381/2381759.xml?temp=.6651728
解决方案 »
- 关于IE8,IE9不跨域,却拒绝访问的问题
- 新手求教: 当控件的visible属性为true时怎样在javascript找到他 各位大哥大姐帮帮忙
- 如何让<input name="radio" value="XX" onclick=变色()>
- frameset
- 如果得到下拉选择框中的那个"value"
- 急、急、急请大家帮忙!!!
- 业务逻辑关系
- 为什么在主页面中会弹出不可控的2级子页面出来?什么办法可以解决?
- 一个Location的hash问题,我想利用Location的hash来定位一个页面中的<a>的位置,可是不行啊。
- 在脚本里面改变input的值,会触发什么事件?
- 猪一般的js正则式,大家帮帮忙
- 如何得到x为底的Y的对数,急啊
了
代码:在你的iframe的页面里加
-----------------------------
function changeIframeHeight() //自动改变 Iframe 的高度
{
if(top != self)
{
window.parent.document.getElementById(self.name).height =
document.body.scrollHeight;
}
}
function window.onload()
{
changeIframeHeight(); //改变 Iframe 高
}
<body onload="init()">
<iframe scrolling=no id=i1 src='test6.html'>
</iframe>
<script>
function init()
{
document.all.i1.style.height = document.all.i1.contentWindow.document.body.style.height + document.all.i1.contentWindow.document.body.scrollHeight
document.all.i1.style.width = document.all.i1.contentWindow.document.body.style.width + document.all.i1.contentWindow.document.body.scrollWidth;
}
</script>
</body>test6.html
<body >
fsd<br>
<br><br><br>
<br><br>
dfsfsfdsfsdf<br>
<br>
<br>
<br>
<br><br>
dfs<br><br>
<br><br><br><br>
<br>
<br>sdf
</body>
<script language="JavaScript">
<!--
demo.document.designMode="on"
//-->
</script>
<input type="submit" onclick="demo.focus();demo.document.selection.createRange().pasteHTML('fason')">