In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "JavaScript how to realize the function of refreshing the framework and pages". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian to study and learn "JavaScript how to realize the function of refreshing the framework and pages" together.
Let's start with a simple example.
The following three pages named frame.html, top.html, bottom.html as an example to explain how to do.
frame.html consists of two pages, top (top.html) and bottom (bottom.html). The code is as follows:
< HTML > < HEAD > < TITLE >frame
< frameset rows ="50%,50%" > < frame name =top src ="top.html" > < frame name =bottom src ="bottom.html" >Now suppose top.html has seven buttons to refresh bottom.html. You can use the following seven statements, which is easy to use.
Statement 1. window.parent.frames[1].location.reload();
Statement 2. window.parent.frames.bottom.location.reload();
Statement 3. window.parent.frames["bottom"].location.reload();
Statement 4. window.parent.frames.item(1).location.reload();
Statement 5. window.parent.frames.item('bottom').location.reload();
Statement 6. window.parent.bottom.location.reload();
Statement 7. window.parent['bottom'].location.reload();
The top.html page code is as follows:
< HTML > < HEAD > < TITLE >top.html
< 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 >Below is the source code for the bottom.html page. To prove that the page below has indeed been refreshed, a dialog box pops up after loading the page.
The code for the bottom.html page is as follows:
< HTML > < HEAD > < TITLE >bottom.html
< BODY onload ="alert('我被加载了!')" > < h2 >This is the content in bottom.html.
Explain:
1.window refers to the current page, e.g. for this case it refers to the top.html page.
Parent refers to the parent page of the current page, that is, the frame page that contains it. For example, for this example it means framedemo.html.
frames is a window object, an array. It represents all the child pages within the frame.
4. Item is a method. Returns the elements of an array.
5. If the child page is also a frame page, and there are other child pages inside, then some of the above methods may not work.
Attached:
There are several ways to refresh Javascript pages:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
Automatic page refresh method:
1. Automatic page refresh: add the following code to the area
20 of which refers to a page refresh every 20 seconds.
2. The page automatically jumps: Add the following code to the area
20 of them refer to jump to http://www.wyxg.com page after 20 seconds
3. The page automatically refreshes
function myrefresh() { _window.location.reload(); } setTimeout ('myrefresh ()',1000); //Specify refresh once every 1 second
ASP.NET How to Output Refresh Parent Window Script Statements
1. this.response.write("opener.location.reload();");
2. this.response.write("opener._ window.location.href = opener._ window.location.href;");
3. Response.Write("opener.window.navigate (''The page you want to refresh.asp'');")
JS Refresh Framework Script Statements
//How to refresh the page containing the frame with parent.location.reload(); //child window refreshes parent window self.opener.location.reload(); (or refresh ) //How to refresh another frame's page with parent. another FrameID.location.reload();
If you want to refresh when closing a window or refresh when opening a window, call the following statement in.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.