内部嵌套2层frame. frame无滚动条, window高度根据frame网页高度自适应javascript.
来源:互联网 发布:电子刊物制作软件 编辑:程序博客网 时间:2024/05/18 00:33
_______________________________________________
|___________________1__________________________|
| | | |
| 2 | 3 | 4 |
| | | |
|____|_____________________________________|_____|
3+4 = frame1, 3= frame2
自适应代码:
function SetWindowHeight(obj)
{
var win=obj;
if (document.getElementById)
{
if (win && !window.opera)
{
if (win.contentDocument && win.contentDocument.body.offsetHeight){
win.height = win.contentDocument.body.offsetHeight; // firefox?
if(win.height<670)
win.height = 670;
$(window.parent.parent.document).find("#frame1").attr("height", win.height);
}
else if(win.Document && win.Document.body.scrollHeight){
win.height = win.Document.body.scrollHeight; // ie?
if(win.height<670)
win.height = 670;
$(window.parent.parent.document).find("#frame1").attr("height", win.height);
}
}
}
window.parent.parent.document.body.scrollTop = 0;
}
另一段调整高度代码:
function setHeight1(){
if(navigator.appName == 'Microsoft Internet Explorer') {
var centerFrame = parent.document.getElementById("frame1");
var height = centerFrame.contentWindow.document.documentElement.scrollHeight;
height = height - $("#aaa").height();
centerFrame.height = height;
parent.parent.document.getElementById("frame1").height = height;
}else{
var centerFrame = parent.document.getElementById("centerFrame");
var height = centerFrame.contentWindow.document.body.scrollHeight;
height = height - $("#aaa").height();
centerFrame.height = height;
parent.parent.document.getElementById("content").height = height;
}
}
function setHeight2(){
if(navigator.appName == 'Microsoft Internet Explorer') {
var centerFrame = parent.document.getElementById("frame2");
var height = centerFrame.contentWindow.document.documentElement.scrollHeight;
centerFrame.height = height;
parent.parent.document.getElementById("frame1").height = height;
}else{
var centerFrame = parent.document.getElementById("frame2");
var height = centerFrame.contentWindow.document.body.scrollHeight;
centerFrame.height = height;
parent.parent.document.getElementById("frame1").height = height;
}
}
- 内部嵌套2层frame. frame无滚动条, window高度根据frame网页高度自适应javascript.
- frame 高度自适应
- frameset下的frame中的网页高度根据frame变化
- frameSet&frame 调整高度 消除滚动条
- 用js控制frame框架自适应高度
- UITableViewCell高度自适应探索--AutoLayout结合Frame
- frame高度自动适应
- JavaScript -- Frame and window
- div panel frame 高度 宽度
- frameset中的frame高度问题
- view的frame高度根据键盘出现、消失改变
- css textarea 高度自适应,无滚动条
- frame去掉横向滚动条
- frame
- frame
- frame
- Frame
- Frame
- PHP 技术总结
- css 和 jquery height() 和 hide()
- 浅析android中的权限管理--用户安装的apk的uid,gid是如何分配的
- How to use HM software(H.265)
- 建立有序双向循环链表
- 内部嵌套2层frame. frame无滚动条, window高度根据frame网页高度自适应javascript.
- C++中类的三种继承方式
- linux中断流程详解
- 微软一站式示例代码库(中文版)2011-09-24版本, 新添加ASP.NET, Windows Base, Silverlight, WinForm等20个Sample
- ejb的调用机制
- as3 点到线段最短距离 函数
- B-树和B+树
- 裸设备基础知识
- [Apache Click快速开发]开发环境配置初试