web前端|js教程
让iframe自适应高度(支持XHTML,支持FF)
web前端-js教程
先说明,这个办法只限于iframe中的子页面也是本地页面(不能引用外网页面)
如何搭建一个博客网站源码,ubuntu 是否安装g ,tomcat6.x安装,如皋爬虫店,php特殊符号转义,高清seolzw
======方法=====
第一步 js部分
网络摄像头控制源码,vscode扩展终端,Ubuntu nfw,tomcat8.5.12,c语言操作sqlite 3,08cms采集插件,vv7前端框架总成更换,梦见孩子肚子往外爬虫子,php 分享系统,seo课程宣传文案,网站源码有几种语言好,html5黑洞特效网页,办公门户网站模板下载lzw
function getSize() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac…would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
udp攻击源码易语言,vscode搜索框显示出来,ubuntu cd中文,删除安装版tomcat,雅虎天气爬虫,php如何接收xml数据,江苏核心关键词seo公司lzw
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
y = pageHeight;
} else {
pageHeight = yScroll;
y = pageHeight;
}
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
这段代码用来获取目标页的参数,包括页面高、宽,屏幕高、宽
function autoHeight(pid) {
var x = new getSize();
parent.document.getElementById(pid).height=x[1];
}
这段代码用来实现父页面中iframe的高度自适应
\\\\\\\\\\
第二步 页面部分
这是父页面的iframe,没什么特别的,和普通的iframe一样,不过要设置好id值,以便子页面的参数调用。
在body中利用onload事件,将自身的高度传给父页面的iframe。