手机
当前位置:查字典教程网 >编程开发 >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下测试通过]】相关文章:

JavaScript的正则表达式中test()方法的使用

在JavaScript中处理字符串之link()方法的使用

javascript获取select值的方法分析

JavaScript中的italics()方法的使用介绍

window.onload与$(document).ready()的区别分析

破解Session cookie的方法

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

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

原生js实现的贪吃蛇网页版游戏完整实例

详解AngularJS中的表格使用

精品推荐
分类导航