惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - 往事如风

抓取之近似网页过滤 基情四射的两个css样式 Hadoop 2.4.1 登录认证配置小结 Window中调试HBase问题小结 改了改博客界面 Hbase0.98.4/Hadoop2.4.1整合小结【原创】 Hadoop 2.4.1 Map/Reduce小结【原创】 hadoop的dfs工具类一个【原创】 简化 Hadoop 2.4.1 Eclpse 插件编译【原创】 Hadoop 2.4.1 设置问题小结【原创】 spring的自动装配导致quartz出问题【原创】 关于用jsp生成xml的问题【原创】 - 往事如风 - 博客园 spring的单例导致webwork文件上传出现问题【原创】 resin版本导致的webwork2.2.4找不到xwork.xml【原创】 Gel备注【原创】 struts的action直接输出中文备注【原创】 - 往事如风 - 博客园 网上流行的flash切换图片之研究【原创】 FreeMarker生成xml的教训【原创】 图解MyEclipse配置struts+hibernate+spring+FreeMarker【原创】
iframe高度处理【原创】
往事如风 · 2006-09-29 · via 博客园 - 往事如风

  以前处理iframe高度的时候,是在每个页面里写两句js,感觉太烦了,今天处理了下,并增加对ff的支持。代码如下:

/**
 * iframe高度处理
 * @author zxub 2006-09-29
 
*//**
 * 设置iframe高度等于内部页面高度,用于内部页面
 
*/ 
function setParentHeight(_iframeId)
{    
    
if (parent.setIFrameHeight) return;
    
    
if (window.addEventListener) //firefox
    {       
        
var _action=function()
        {            
            
var _iframe=parent.document.getElementById(_iframeId);
            
if (!_iframe) return;
            _iframe.height
=_iframe.contentDocument.body.offsetHeight+16;
        }   
        window.addEventListener(
"load", _action, false);
    }
    
else if (window.attachEvent) //IE
    {
        
var _action=function()
        {
            
if (!parent.document.getElementById(_iframeId)) return;
            parent.document.getElementById(_iframeId).height
=document.body.scrollHeight;
        }
        window.attachEvent(
"onload", _action);
    }
}
/**
 * 设置iframe高度等于内部页面高度,用于父级页面
 
*/
function setIFrameHeight(_iframeId)
{    
    
if (window.addEventListener) //firefox
    {          
        
var _action=function()
        {       
            
var _iframe=document.getElementById(_iframeId);
            
if (!_iframe) return;
            _iframe.height
=_iframe.contentDocument.body.scrollHeight;
            _iframe.onload
=function()
            {
                
this.height=this.contentDocument.body.offsetHeight+16;
            }
        }
        window.addEventListener(
"load", _action, false);
    }
    
else if (window.attachEvent) //IE
    {
        
var _action=function()
        {        
            
if (!document.getElementById(_iframeId)) return;
            document.getElementById(_iframeId).height
=document.frames[_iframeId].document.body.scrollHeight;
            document.getElementById(_iframeId).onreadystatechange
=function()
            {
                
if (this.readyState=="complete")
                {
                    
this.height=document.frames[_iframeId].document.body.scrollHeight;
                }
            }
        }
        window.attachEvent(
"onload", _action);
    }
}

  setIFrameHeight()最简单了,只要在主页面加这么一句就可以了,内部页面就不需要写什么了。