In the IFRAME structure, how does the parent window know that the child window is loaded?

Source: Internet
Author: User

Yesterday, I found a lot of information, we find this useful, similar to the Document.ready method has not been found

Window.onload: All elements of the page loaded, including pictures

$ (document). Ready: Document structure loaded, the picture does not necessarily load

Http://zhidao.baidu.com/link?url=Z7h_mNkeKQ3y3GYWKFEm7a4VrYzXcWEwolDVdSPScaCWFID0_5d7G0xOfmecHqL7hD0FjEde0qdTAudqkaY2uq


The more silly way is to read some of the contents of the IFRAME regularly.

Nicholas C. Zakas article "IFRAMEs, onload, and Document.domain" in the comments Christopher provides a new method of Judgment (perfect):
var iframe = document.cr Eateelement ("iframe");
iframe.src = ' your URL ';
if (iframe.attachevent) {
    iframe.attachevent ("onload", function () {
        alert ("Local iframe are now loaded.");
    });
else {
    iframe.onload = function () {
        alert ("Local iframe are now loaded.");
} Document.body.appendChild (IFRAME);
Ask
Thank you ~ but oh,
iframe.attachevent ("onload", function ()
This sentence and
iframe.onload
So what is the difference?

Reply
Answer:: This is for browser compatibility. IE in the creation of a new IFRAME when the OnLoad method needs to use Attachevent to bind, and the original IFrame of the OnLoad method, you can directly bind. You put two alert ("Local iframe are now loaded."); Change the information to a different try. IE opens the previous one, and FF opens the latter one.

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.