Seven methods for refreshing the framework subpage in js Code _ javascript skills

Source: Internet
Author: User
The seven methods for js to refresh the framework subpage are described in detail by naming the three pages as framedemo.html, top.html, and button.html.
In this example, framedemo.html consists of two pages:

The Code is as follows:





FrameDemo







Now, let's set the top.html, that is, there is a button on the above page to refresh the following page. You can use the following seven statements.
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 ();
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.
Top.html source code; (there are seven buttons on the page, and the function is to refresh the following framework page)

The Code is as follows:
























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 is as follows:







This is the content in button.html.

Related Article

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.