When the window. onload and onload attributes in JS exist simultaneously

Source: Internet
Author: User

Transfer from http://topic.csdn.net/u/20100608/14/aa805ed6-0820-47c7-b866-6dd93d90ea67.html (10 floor)

Scenario 1: The function specified by window. onload is anonymous, and only the latter is executed, and the action is the latter action. For example:

---- Display: ACD
Case 2: If the function specified by window. onload is not anonymous, It will be executed. The former is prior to the latter. For example:

<HTML> 

---- Display in sequence: Abd
Window. onload in <body>
Case 3: If the function specified by window. onload is anonymous, only the latter is executed, but the former is the former. For example:

---- Display in sequence: BDC
Case 4: If the function specified by window. onload is not anonymous, It will be executed. The former is better than the latter. For example:

<HTML> 

---- Display in sequence: bytes

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.