<script type="text/javascript">
//光标移动到顶部
this.to_top=function(){
$("html,body").animate({scrollTop:0}, 500);
} this.setCwinHeight=function (iframeObj) { /* 8、获取iframe的高度
iframe.contentWindow.document.body.offsetHeight;
如果要获取iframe中的iframe
document.getElementById('iframId').onload=function(){
var html= window.frames["name属性"].frames["name属性"].document.getElementById('iframe中的元素的id').innerHTML; $('#iframeId').load(function() { //方法1
var iframeHeight = Math.min(iframe.contentWindow.window.document.documentElement.scrollHeight, iframe.contentWindow.window.document.body.scrollHeight);
var h=$(this).contents().height();
$(this).height(h+'px');
});
*/
if (document.getElementById) {
if (iframeObj && !window.opera) {
if (iframeObj.contentDocument
&& iframeObj.contentDocument.body.offsetHeight) {
if (a = iframeObj.getAttribute("id") == "video_top") {
iframeObj.height = iframeObj.contentWindow.document.body.offsetHeight;
} else if (iframeObj.getAttribute("id") == "video_bottom") {
iframeObj.height = iframeObj.contentWindow.document.body.offsetHeight;
} else if (document.frames[0].contentWindow
&& document.frames[0].contentWindow.document.body.scrollHeight) {
var height = document.frames[0].document.body.scrollHeight;
}
}
}
}
}
</script>
//src为子frame间接路径
<iframe id="video_bottom" src="${pageContext.request.contextPath}/vcomment/videoBottom/${videoId}.htm" width="90%" frameborder="0" scrolling="no" onload="setCwinHeight(this);"></iframe>

  

iframe根据子frame的高度自动高度的更多相关文章

  1. html中iframe根据子页面内容动态修改高度

    JavaScript var browserVersion = window.navigator.userAgent.toUpperCase(); var isOpera = browserVersi ...

  2. iframe自动高度

    <script> //设置iframe自动高度 function setIframe(id){ var fn = function(){ try{ var iframe = typeof ...

  3. (转载)html中div使用自动高度

    为什么要使用div标签 1.更多的配置项,那就意味着更灵活,当然,难度也更高: 2.可以方便的容纳其他html标签:     static定位就是不定位,出现在哪里就显示在哪里,这是默认取值,只有在你 ...

  4. 纯CSS实现侧边栏/分栏高度自动相等

    by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=694 一.为何要分栏高 ...

  5. textarea宽度、高度自动适应处理方法

    textarea自动高度 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http: ...

  6. css 子div自适应父div高度

    <div class="out"> <div class="a"></div> <div class="b& ...

  7. 纯CSS兑现侧边栏/分栏高度自动相等(转)

    这里直接介绍我认为的最佳的侧边栏/分栏高度自动相等方法.核心的CSS代码如下(数值不固定): margin-bottom:-3000px; padding-bottom:3000px; 再配合父标签的 ...

  8. KindEditor 销毁与自动高度冲突解决

    前提准备情况: KindEditor(KE)  +  easyUI 1.通过 EasyUI.Window 打开一个窗口,窗口中包含一个 KE编辑器:在次打开WIndow 的时候 KE会出现编辑器里面的 ...

  9. 子元素浮动父容器高度不能自适应的CSS解决方法

    百度标题:子元素浮动父容器高度不能自适应的CSS解决方法 从第二份工作开始,已经不怎么写样式了,然后就忘记了一部分,有的也生疏了. 今天碰到子元素意外挤到一起的问题,就问公司前端工程师是怎么回事,F1 ...

随机推荐

  1. 实践周java基础软件开发app之五子棋

    五子棋人机对战实践项目 总的任务和目标 完成一个人机对战的五子棋项目,基本效果如下: 第一部分 Java绘图原理 1.   基本概念 像素,坐标 第二部分 绘制棋盘 1.   基本思路 在一个JPan ...

  2. Linux学习--第八天--acl、SetUID、SetGID、chattr、lsattr、sudo

    acl权限 文件只能有一个所属组 acl就是不管用户什么组了,直接针对某个文件给他特定权限. acl需要所在分区文件系统的支持. df -h #查看分区 dumpe2fs -h /dev/sda3 # ...

  3. uwsgi_response_write_body报错的几种情况

    1.uwsgi_response_write_body_do(): Broken pipe 出现这种情况一般是由于客户端无法等到服务端的回应而关闭了连接,常出现与nginx + uwsgi的情况,当u ...

  4. c语言日志打印

    #include <stdio.h> #include <stdlib.h> #include <time.h> #include <stdarg.h> ...

  5. Vue的css动画原理

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. rsync+inotify实时数据同步单目录实战

    rsync+inotify实时数据同步单目录实战   rsync+inotify实时数据同步单目录实战 inotify是一个强大的.细粒度的.异步的文件系统事件监控机制,linux内核从2.6.13起 ...

  7. 一种循环C字符数组的骚操作

    #include <stdio.h> #include <stdlib.h> int main() { char wenwa[] = "程劲小盆友在做什么" ...

  8. 【知识】定时器setTimeout/setInterval执行时this指针指向问题

    [问题描述] setTimetout/setInterval中this指针指向window,以下是一个小demo: var demoChange = { key: true, changeFun() ...

  9. ExcelUtils

    本ExcelUtils工具类是用poi写的,仅用于线下从excel文件中读取数据.如果生产环境要用的话,建议切换到阿里的easyexcel. 引入poi.jar: <!-- https://mv ...

  10. make all age=20 makefile 传参数

    你可以直接在Make的时候,在命令行下面传入一个参数或者变量,它会覆盖掉Makefile里面的变量或者参数.比如,在你的Makefile里面定义了一个变量age. .PHONY:all AGE = a ...