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

链接渐变效果

如何实现iframe(嵌入式帧)的自适应高度

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

关于IFRAME 自适应高度的研究

javascript无刷新评论实现方法

破解Session cookie的方法

JavaScript中的私有成员

JQuery中DOM实现事件移除的方法

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

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

精品推荐
分类导航