Document. Body. appendchild () causes IE to terminate the operation

Source: Internet
Author: User

When I wrote JS today, I suddenly found that my test page was good under ff, but when I opened it with IE, I always showed the error "ie cannot open XXX page, ended operation, later I found thatProgramThe document. Body. appendchild () Statement is at fault. The implementation mechanism in FF is that the body element already exists when the page has not been fully read, and IE exists only when the page completely reads the end Body element, therefore, an error occurs when you insert the preceding statement to the page in IE. The solution is also very simple. One way is to put this statement into the window. the second method is to use setTimeout for delayed asynchronous calls. Another method is to put the statement after the </body> label.

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.