Introduction to page reload (current page/upper-level page) and frame or iframe element reference in js

Source: Internet
Author: User

Use JavaScript to refresh the upper-level page and current page
Copy codeThe Code is as follows:
<Script type = "text/javascript">
// Refresh the superior page
// Specify parameter parent.main.doc ument. location. reload ();
// Refresh the current page
Document. location. reload ();
</Script>

Each frame element or iframe element is a framework. This framework is a window that loads an html document. The following methods can be used to reference the frame or iframe element:
Copy codeThe Code is as follows:
Window. frames [index]
Windows. frames ["framework name"]
Windows. Framework name

If you want to obtain a reference to the parent window from the webpage loaded by the framework, you can use the following method:
Copy codeThe Code is as follows:
Window. parent

To reference a framework in the parent window, you can use the following method:
Copy codeThe Code is as follows:
Window. parent. Framework name

You can also use the following method to obtain reference to the top frame of the parent window:
Copy codeThe Code is as follows:
Window. top

As long as you get a reference to the framework, you can control the framework object !!!

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.