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

推荐订阅源

小众软件
小众软件
Cloudbric
Cloudbric
G
Google Developers Blog
博客园_首页
博客园 - 司徒正美
N
Netflix TechBlog - Medium
Recorded Future
Recorded Future
博客园 - 叶小钗
C
Check Point Blog
L
LangChain Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
Cyberwarzone
Cyberwarzone
Project Zero
Project Zero
V
Vulnerabilities – Threatpost
C
Cisco Blogs
Scott Helme
Scott Helme
Last Week in AI
Last Week in AI
博客园 - 聂微东
T
Threat Research - Cisco Blogs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Hacker News
The Hacker News
Forbes - Security
Forbes - Security
Simon Willison's Weblog
Simon Willison's Weblog
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿
AWS News Blog
AWS News Blog
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
N
News | PayPal Newsroom
Help Net Security
Help Net Security
B
Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
Tenable Blog
I
InfoQ
S
Securelist
V
Visual Studio Blog
U
Unit 42
博客园 - 【当耐特】
S
Security @ Cisco Blogs

博客园 - 绯村剑心

日期对象ToString方法格式符的大小写对输出结果是有影响的 - 绯村剑心 - 博客园 Ajax基础配置 — XMLHttpRequest 让文本输入框只能输入数字 - 绯村剑心 - 博客园 抓取网页中的链接 检测客户端显示器分辨率、浏览器类型和客户端IP 在ASP.NET 中实现单点登录(利用Cache, 将用户信息保存在服务器缓存中) 对于长时间装载的ASP.NET页面如何在客户端浏览器中显示进度? 带图片的,多列的DropDownList的实现 - 绯村剑心 - 博客园 一个很不错介绍session的文章 无法从Web服务器获取项目文件 曼彻斯特码与差分曼彻斯特码 如何清除SQL server日志 sql server日志文件总结及日志满的处理办法 SQL SERVER 安装问题详解 Server实用操作小技巧集合 从html中提出纯文本 创建高度动态变化的Iframe 上传图片并生成缩略图 ASP.NET程序中常用的三十三种代码
用JAVASCRIPT来刷新框架子页面的七种方法。
绯村剑心 · 2006-08-30 · via 博客园 - 绯村剑心

下面以三个页面分别命名为framedemo.html,top.html,button.html为例来具体说明如何做。

其中framedemo.html由上下两个页面组成,代码如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE> frameDemo </TITLE>

</HEAD>

<frameset rows="50%,50%">

<frame name=top src="top.html">

<frame name=button src="button.html">

</frameset>

</HTML>

 现在假设top.html即上面的页面有一个button来实现对下面页面的刷新,可以用以下七种语句,哪个好用自己看着办了。

  语句1. window.parent.frames[1].location.reload();

  语句2. window.parent.frames.bottom.location.reload();

  语句3. window.parent.frames["bottom"].location.reload();

  语句4. window.parent.frames.item(1).location.reload();

  语句5. window.parent.frames.item('bottom').location.reload();

  语句6. window.parent.bottom.location.reload();

  语句7. window.parent['bottom'].location.reload();

  解释一下:

1.window指代的是当前页面,例如对于此例它指的是top.html页面。

  2.parent指的是当前页面的父页面,也就是包含它的框架页面。例如对于此例它指的是framedemo.html。

  3.frames是window对象,是一个数组。代表着该框架内所有子页面。

  4.item是方法。返回数组里面的元素。

  5.如果子页面也是个框架页面,里面还是其它的子页面,那么上面的有些方法可能不行。

  top.html源代码;(页面上有七个按钮,功能都是刷新下面的框架页面)

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

</HEAD>

<BODY>

<input type=button value="刷新1" onclick="window.parent.frames[1].location.reload()"><br>

<input type=button value="刷新2" onclick="window.parent.frames.bottom.location.reload()"><br>

<input type=button value="刷新3" onclick="window.parent.frames['bottom'].location.reload()"><br>

<input type=button value="刷新4" onclick="window.parent.frames.item(1).location.reload()"><br>

<input type=button value="刷新5" onclick="window.parent.frames.item('bottom').location.reload()"><br>

<input type=button value="刷新6" onclick="window.parent.bottom.location.reload()"><br>

<input type=button value="刷新7" onclick="window.parent['bottom'].location.reload()"><br>

</BODY>

</HTML>

下面是bottom.html页面源代码,为了证明下方页面的确被刷新了,在装载完页面弹出一个对话框。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

</HEAD>

<BODY onload="alert('我被加载了!')">

<h1>This is the content in button.html.</h1>

</BODY>

</HTML>