Iframe自动适应高度
function sizeChange()
{
window.status=AAA.document.body.scrollHeight;
document.all.AAA.height=AAA.document.body.scrollHeight;
}
![]()
![]()
![]()
..
![]()
<IFRAME id="AAA" src='<%# DataBinder.Eval(Container.DataItem, "HTML") %>' frameBorder=0 width="100%" scrolling=no> </IFRAME>
又找到一个好的
<script type=text/javascript>
<!--
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0
![]()
function dyniframesize(down) {
var pTar = null;
if (document.getElementById){
pTar = document.getElementById(down);
}
else{
eval('pTar = ' + down + ';');
}
if (pTar && !window.opera){
//begin resizing iframe
pTar.style.display="block"
![]()
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
//ns6 syntax
pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight;
}
else if (pTar.Document && pTar.Document.body.scrollHeight){
//ie5+ syntax
pTar.height = pTar.Document.body.scrollHeight;
}
}
![]()
}
-->
</script>
</HEAD>
<body onmousemove="closesubnav(event);">
![]()
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<uc1:Admin_header id="Admin_header1" runat="server"></uc1:Admin_header></FONT>
<div id="pagecell1" >
<iframe name="down" width="100%" frameborder="0" src="introduction.aspx" scrolling="no" id="down" onload="javascript:dyniframesize('down');"
/>
</div>
</form>
![]()
</body>
</HTML>
function sizeChange()
{
window.status=AAA.document.body.scrollHeight;
document.all.AAA.height=AAA.document.body.scrollHeight;
} 


.. 
<IFRAME id="AAA" src='<%# DataBinder.Eval(Container.DataItem, "HTML") %>' frameBorder=0 width="100%" scrolling=no> </IFRAME> 
<script type=text/javascript>
<!--
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0 
function dyniframesize(down) {
var pTar = null;
if (document.getElementById){
pTar = document.getElementById(down);
}
else{
eval('pTar = ' + down + ';');
}
if (pTar && !window.opera){
//begin resizing iframe
pTar.style.display="block" 
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
//ns6 syntax
pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight;
}
else if (pTar.Document && pTar.Document.body.scrollHeight){
//ie5+ syntax
pTar.height = pTar.Document.body.scrollHeight;
}
} 
}
-->
</script>
</HEAD>
<body onmousemove="closesubnav(event);"> 
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<uc1:Admin_header id="Admin_header1" runat="server"></uc1:Admin_header></FONT>
<div id="pagecell1" >
<iframe name="down" width="100%" frameborder="0" src="introduction.aspx" scrolling="no" id="down" onload="javascript:dyniframesize('down');"
/>
</div>
</form> 
</body>
</HTML> 


浙公网安备 33010602011771号