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

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

博客园 - 小二哥

Linq To SQL 针对单张表,有关系的2张表做查询 请问:MOSS使用中机器名与IP地址的问题 MOSS: 如何根据AD帐号判断该用户是否属于网站用户? 在SQL数据库中构造树,直接显示在.Net的DropDownList里 今天解决了K2工作流的,会签与并签问题 钱额的大小写转换的JS代码 郁闷了半个下午的javascript 滑动条的风格控制 DropDownList的SelectedValue和SelectedIndex asp.net页面的Page_Load执行两次 分析器错误:访问被拒绝....... 论坛登录页面 今天遇到的几个问题以及解决方法 K2自定义工作流程 .Net中几个容易混淆的概念 郁闷到极点了,VSTO2005问题 ajax实现无刷新两级联动DropDownList 如何从XML字符串获取DataSet Ajax的简单配置与应用.
iframe自适应问题
小二哥 · 2006-07-29 · via 博客园 - 小二哥

有时候会在页面里使用框架,但又不想叫它出现滚动条,这就用到了自适应。
架设default.aspx页面里使用了Iframe,它的ID: iframe1,src指向a.aspx

<IFRAME id="iframe1" name="iframe1" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="no" src="a.aspx"
runat
="server"></IFRAME>

那么在default里使用如下脚本:

function dyniframesize(iframename) 
{
    
var pTar = null;
    
if (document.getElementById)
    
{
        pTar 
= document.getElementById(iframename);
    }

    
else{
        eval('pTar 
= ' + iframename + ';');
    }

    
if (pTar && !window.opera)
    
{
        pTar.style.display
="block"
        
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight)
        
{
            pTar.height 
= pTar.contentDocument.body.offsetHeight+10
        }

        
else if (pTar.Document && pTar.Document.body.scrollHeight)
        
{
            pTar.width 
= pTar.Document.body.scrollWidth;
            pTar.height 
= pTar.Document.body.scrollHeight;
            
        }

    }

}

在body里增加:
onload="dyniframesize('iframe1')"

即可达到当我们打开default.aspx,使得a.aspx自适应大小。
还存在一个问题,当点击a.aspx里的按钮时,需要重新计算他的父页面中的iframe的大小,达到
刷新a.aspx时,页面依然自适应。

function dyniframesize() 
{
    
var pTar = null;
    
if (document.getElementById)
    
{
//仅仅修改此句代码:        
pTar = window.parent.document.getElementById("iframe1");
    }

    
else{
        eval('pTar 
= ' + iframename + ';');
    }

    
if (pTar && !window.opera)
    
{
        pTar.style.display
="block"
        
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight)
        
{
            pTar.height 
= pTar.contentDocument.body.offsetHeight+10
        }

        
else if (pTar.Document && pTar.Document.body.scrollHeight)
        
{
            pTar.width 
= pTar.Document.body.scrollWidth;
            pTar.height 
= pTar.Document.body.scrollHeight;
            
        }

    }

}

同样在a.aspx的body里加载这个函数。
onload="dyniframesize()"