Loads external scripts into the page without executing any inline scripts. However, the following usage is incorrect:

In this example, the inline script will be ignored because the src attribute is present. To execute an inline script, the src attribute must be omitted:

","image":"http://www.luping.net/uploads/20241104/173069029667283cf8c7d54.jpg","datePublished":"2024-11-04T12:45:54+08:00","dateModified":"2024-11-04T12:45:54+08:00","author":{"@type":"Person","name":"luping.net","url":"https://www.luping.net/articlelist/0_1.html"}}
"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"

Can you include both inline scripts and an SRC attribute in a tag?

Published on 2024-11-04
Browse:236

Can you include both inline scripts and an SRC attribute in a  tag?

JavaScript: Inline Script with SRC Attribute

JavaScript inline scripts are commonly included using the

According to the HTML 4.01 Specification, the behavior of a

If the src attribute is not set, the user agent MUST interpret the element's contents as script. If src has a URI value, the user agent MUST ignore the element's contents and retrieve the script via the URI.

This means that the src attribute in the

Loads external scripts into the page without executing any inline scripts. However, the following usage is incorrect:

In this example, the inline script will be ignored because the src attribute is present. To execute an inline script, the src attribute must be omitted:

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3