JavaScript settings get IFRAME page element and page overload method

Source: Internet
Author: User

1, the implementation of JavaScript overload IFRAME page, compatible with the browser method

The code is as follows Copy Code
document.getElementById (Frameid). ContentWindow.location.reload (True);

2, the second is to get the elements within the IFRAME and apply

The code is as follows Copy Code
Iframe.contentWindow.document.getElementById (ID). style.display= "Block";

3,iframe page calls a function in the parent page

Parent.dofunction ();

Contentwindow instance

The code is as follows Copy Code

iframe = document.getElementById ("frame");
Iframe.contentWindow.location = "http://mozilla.org";
Iframe.contentWindow.history.back ();


Reference

Http://www-archive.mozilla.org/docs/dom/domref/dom_frame_ref5.html


The Contentwindow property returns the Window object for the frame.

Syntax

The code is as follows Copy Code
FrameWindow = Frameelement.contentwindow

Parameters
FrameWindow is a object reference to the "Window object for this frame."

Example

The code is as follows Copy Code
f = document.getElementById ("frame");

F.contentwindow.location = "http://mozilla.org";

F.contentwindow.history.back ();


Notes
You can also get to the Window object through a named frame. For example, a frame with the name= "MyFrame" can refer back to the Window object as window.frames["MyFrame"].

Specification
DOM Level 2--htmlframeelement

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.