手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >iframe 自适应高度[在IE6 IE7 FF下测试通过]
iframe 自适应高度[在IE6 IE7 FF下测试通过]
摘要:第一种方法:复制代码代码如下:第二种方法:jscode:复制代码代码如下://iframe自适应高度[在IE6IE7下测试通过]functi...

第一种方法:

复制代码 代码如下:

<script type="text/javascript" language="javascript">

<>

</script>

<iframe id="content01" name="content01" frameBorder=0 scrolling=no src="main.html" width="100%"onLoad="TuneHeight()" ></iframe>

第二种方法:

js code:

复制代码 代码如下:

//iframe自适应高度[在IE6 IE7下测试通过]

function reSetIframe(){

var iframe = document.getElementById("iframeId");

try{

var bHeight = iframe.contentWindow.document.body.scrollHeight;

var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;

var height = Math.max(bHeight, dHeight);

iframe.height = height;

}catch (ex){}

}

html:

复制代码 代码如下:

<iframe src="" id="weather" name="weather" width="278" onload="reSetIframe()" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" border="0" framespacing="0"> </iframe>

【iframe 自适应高度[在IE6 IE7 FF下测试通过]】相关文章:

破解Session cookie的方法

你都知道吗关于高性能JAVASCRIPT?

js获取页面description的方法

jQuery获取页面元素绝对与相对位置的方法

JQuery控制Radio选中方法分析

使用RequireJS优化JavaScript引用代码的方法

JS/Jquery判断对象为空的方法

png在IE6 下无法透明的解决方法汇总

图片加载进度实时显示

jQuery实现给页面换肤的方法

精品推荐
分类导航