iframe动态改变内嵌页面高度
2016-04-11 14:56
387 查看
test.html
nest.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> </head> <body> <table align=center cellspacing=0 cellpadding=0 height="100%" border=0> <tbody> <tr> <td valign="top" width="206" name="frametitle" id="frametitle"> <iframe style="z-index: 1; visibility: inherit; width: 206px;height:100%" name="leftmenu" id="leftmenu" src="nest.html" frameborder=0 scrolling="no"></iframe> </td> </tr> </tbody> </table> </body> </html> <script type="text/javascript"> function TuneHeight(){ var h = document.getElementById("leftmenu").contentWindow.document.body.scrollHeight + "px"; document.getElementById("frametitle").style.height=h; } window.onload=TuneHeight; </script>
nest.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <script type="text/javascript"> function test(){ document.write("<span>----------------------------------</span>"); window.parent.TuneHeight(); } setInterval(test,1000); </script> </head> <body> </body> </html>
相关文章推荐
- hdu-3078 Network(lca+st算法+dfs)
- js获取url中的请求参数
- Linux主机间建立信任关系,无ssh密码登陆主机的问题
- 第40讲项目5——年龄几何
- kafka常用的配置属性
- Java面试题全集
- javascript特效——页面不停闪烁
- https请求 CFNetwork SSLHandshake failed (-9807) A connection failure occurred: SSL problem
- Android 设置没有 actionBar的 样式
- 下载图片
- JSTL标签 参考手册
- jquery中常用的SET和GET$(”#msg”).html循环介绍
- CentOS安装GitLab
- Java内部类
- [转]JSON.stringify 语法实例讲解
- 内存存储空间简单理解
- Action Extension
- docker基本操作
- Leetcode 83
- 微信JSSDK页面授权实现类(PHP)