Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Which is the external javascript property introduced by HTML

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "which is the external javascript attribute introduced by HTML". In daily operation, I believe that many people have doubts about the external javascript attribute introduced by HTML. Xiaobian consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubt of "which external javascript attribute introduced by HTML". Next, please follow the editor to study!

HTML introduces that the external javascript is the src attribute of the script tag, which specifies the URL; syntax of the external script file.

The operating environment of this tutorial: windows7 system, HTML5&&javascript1.8.5 version, Dell G3 computer.

HTML introduces an external javascript as the src attribute of the script tag.

Tags are used to define client script, such as JavaScript.

The script element can either contain script statements or point to an external script file through the src attribute.

Sometimes we need to run JavaScript on multiple pages of the site. Instead of writing the same script over and over again, just create a JavaScript in a separate file, save it with a .js suffix, and then reference the file using the src attribute in the tag.

Grammar

Value description URL

The URL of the external script. Possible values are:

Absolute URL-points to other sites (such as src= "www.example.com/example.js")

Relative URL-points to a file within the site (such as src= "/ scripts/example.js")

Example:

Output:

Description:

Once the tag uses the src attribute, it serves as an element that references an external file rather than editing a script inside the page. That is, using src indicates that the element is suitable for referencing an external Javascript file, and not for inserting a Javascript script into the page.

This indicates that code should not be inserted into tags that use the src attribute (and useless). This can lead to unpredictable results, and, at least in most browsers, it has no practical effect. If you add the following code to the example of this article:

[xss_clean] ("the content of this output comes from the Javascript of this file.")

It may properly parse the Javascript file referenced by the src attribute, but it may not execute any code that is edited directly within the tag. Obviously, many special properties (such as the attributes that its parts can only be used for external files) determine that it is no longer possible to execute the referenced external file normally while taking into account the content directly edited in it.

At this point, the study of "which is the external javascript attribute introduced by HTML" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report