<iframe name="ifrm" id="frm" src="yourPage.asp"><iframe>
<button onclick="frm.style.height=document.ifrm.document.body.clientHeight">
让iframe高度适应其内叶面高度</button>
<button onclick="frm.style.height=document.ifrm.document.body.clientHeight">
让iframe高度适应其内叶面高度</button>
<iframe src=2.htm id=ifrm></iframe>2.htm的代码:
<script>
function resize()
{parent.document.all.ifrm.height=document.body.scrollHeight;}
</script>
<body onload="resize()">
</body>
<iframe src=2.htm id=ifrm scrolling=no></iframe>
这样,不要滚动条,也不会有内容溢出的情况了.
最好在2.htm里面的高上面再加一个值(考虑边距),这样更保险!(不过不加也无所谓。)
<button onclick="frm.style.height=document.ifrm.document.body.scrollTop">
让iframe高度适应其内叶面高度</button>
看看行不?
<iframe name="ifrm" id="frm" src="yourPage.asp"><iframe>
<button onclick="frm.style.height=document.ifrm.document.body.scrollHeight">
让iframe高度适应其内叶面高度</button>scrollHeight 表示网页正文全文高度,我像应该是对的