iframe根据子frame的高度自动高度
<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的高度自动高度的更多相关文章
- html中iframe根据子页面内容动态修改高度
JavaScript var browserVersion = window.navigator.userAgent.toUpperCase(); var isOpera = browserVersi ...
- iframe自动高度
<script> //设置iframe自动高度 function setIframe(id){ var fn = function(){ try{ var iframe = typeof ...
- (转载)html中div使用自动高度
为什么要使用div标签 1.更多的配置项,那就意味着更灵活,当然,难度也更高: 2.可以方便的容纳其他html标签: static定位就是不定位,出现在哪里就显示在哪里,这是默认取值,只有在你 ...
- 纯CSS实现侧边栏/分栏高度自动相等
by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=694 一.为何要分栏高 ...
- textarea宽度、高度自动适应处理方法
textarea自动高度 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http: ...
- css 子div自适应父div高度
<div class="out"> <div class="a"></div> <div class="b& ...
- 纯CSS兑现侧边栏/分栏高度自动相等(转)
这里直接介绍我认为的最佳的侧边栏/分栏高度自动相等方法.核心的CSS代码如下(数值不固定): margin-bottom:-3000px; padding-bottom:3000px; 再配合父标签的 ...
- KindEditor 销毁与自动高度冲突解决
前提准备情况: KindEditor(KE) + easyUI 1.通过 EasyUI.Window 打开一个窗口,窗口中包含一个 KE编辑器:在次打开WIndow 的时候 KE会出现编辑器里面的 ...
- 子元素浮动父容器高度不能自适应的CSS解决方法
百度标题:子元素浮动父容器高度不能自适应的CSS解决方法 从第二份工作开始,已经不怎么写样式了,然后就忘记了一部分,有的也生疏了. 今天碰到子元素意外挤到一起的问题,就问公司前端工程师是怎么回事,F1 ...
随机推荐
- Linux日常之数据重定向
Linux在启动后,会默认打开3个文件操作符,分别是 (1)标准输入0,standard input (2)正确输出1,standard output (3)错误输出2,standard error ...
- dedecms织梦调用二级和三级分类标签
dedecms调用二级.三级以及调用栏目所有子栏目 <!--频道分类具体内容开始--> <div class="channel_sort"> {dede:c ...
- 由n个已按1,2,3,.....,n编号的人围成一圈,从编号为1的人开始按1,2,3顺序循环报数,凡报到3者出圈,最后留一个人,问其编号是多少
/************************************************************************* > File Name: only_one. ...
- Python核心技术与实战——十八|Python并发编程之Asyncio
我们在上一章学习了Python并发编程的一种实现方法——多线程.今天,我们趁热打铁,看看Python并发编程的另一种实现方式——Asyncio.和前面协程的那章不太一样,这节课我们更加注重原理的理解. ...
- git每次更新都需要输入账号密码,如何解决?
//如果https请求pull每次都需要输入账号密码,则 git config --global credential.helper store 那么,在下一次更新,需要输入账号密码,然后git就 ...
- Perf Event :Linux下的系统性能调优工具
Perf Event :Linux下的系统性能调优工具 2011-05-27 10:35 刘 明 IBMDW 字号:T | T Perf Event 是一款随 Linux 内核代码一同发布和维护的性能 ...
- 对items函数的理解
老师:dict的items应该是把dict转成列表,每个列表元素是一个包含key ,value的dict,元素应该是元组, {a:1, b:2, c:3} [(a, 1), (b,2), (c, ...
- 百度地图api的简单应用(一):POI检索
使用之前,需要注册一个百度地图开发者账号,最好申请一个认证以获取更高的使用配额和并发上限. 注册之后,申请一个应用,获得一个ak(密钥),并填写ip地址白名单.(这里我使用0.0.0.0/0,查了自己 ...
- layui.form is not a function
改变: var form = layui.form; 如果你是从1.x升级2.x造成的,那只需要在定义的时候吧后面的()去掉就可以了.请关注更新日志:1.x 升 2.0 特别注意事项layDate日期 ...
- window.location.hash(hash应用)---跳转到hash值制定的具体页面
location是javascript里边管理地址栏的内置对象,比如location.href就管理页面的url,用location.href=url就可以直接将页面重定向url.而location. ...