Javascript code refresh framework page _ javascript skills

Source: Internet
Author: User
Js refresh framework PAGE method. Sometimes you need to control the page content refresh in the framework. The following methods are detailed. For more information, see. Let's look at a simple example:
The following example uses the three pages separated by frame.html?top.html?bottom.html to describe how to do this.
Frame.html consists of two pages (bottom (bottom.html) under the top (top.html#). The Code is as follows:

The Code is as follows:





Frame







Now, let's assume that top.html (the page above) has seven buttoners to refresh bottom.html (the page below). You can use the following seven statements to see which one 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 code for the top.html page is as follows:

The Code is as follows:





Top.html



















The following is the source code of the bottom.html page. to verify that the page below is refreshed, a dialog box is displayed after the page is loaded.

The code for the bottom.html page is as follows:

The Code is as follows:





Bottom.html


This is the content in bottom.html.



Explanations:
1. windowless refers to the front page. For example, this refers to the top.html page.
2. parent refers to the parent page of the current page, that is, the framework page containing it. In this example, framedemo.html is used.
3. frames is a window object and an array. Represents all the child pages in the framework.
4. item is a method. Returns the elements in the array.
5. If the sub-page is also a framework page and contains other sub-pages, some of the above methods may not work.

Appendix:
How to refresh the page with Javascript:
1 history. go (0)
2 location. reload ()
3 location = location
4 location. assign (location)
5 document.exe cCommand ('refresh ')
6 window. navigate (location)
7 location. replace (location)
8 document. URL = location. href

How to automatically refresh the page:
1. Automatically refresh the page: Add the following codeRegion

20 indicates refreshing the page every 20 seconds.

2. automatic page Jump: Add the following codeRegion

Among them, 20 refers to jump to HTTP: // www every 20 seconds. Wyxg. Com page

3. Automatically refresh js version on the page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.