In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to use js in html5. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Two ways to use js in html5:
There are two ways to use tags: directly embed JavaScript code in the page and include external JavaScript files; browsers parse elements in the order in which they appear on the page.
Embed the script:
one
two
three
/ / js code
External script:
one
Advantages of external scripts:
● maintainability
● cacheable: browsers can cache all linked external JavaScript files according to specific settings
● adapts to the future
Label
The main way to insert JavaScript into a HTML page is to use elements.
Elements have two common attributes:
● src: represents an external file that contains the code to be executed. The src attribute is required if you want to include an external JavaScript file through an element. The value of this property is a link to an external JavaScript file.
Note: elements with the src attribute should not contain additional JavaScript code between them and the tag. If embedded code is included, only external script files are downloaded and executed, and embedded code is ignored. You can also include JavaScript files from external domains through the src attribute of the element. Example:
one
two
● type: specifies the MIME type of the script. The type attribute marks the content between the tag and the tag.
Description: the MIME type consists of two parts: media type and subtype. "text/javascript" for JavaScript,MIME type.
Note: the type attribute is no longer required in HTML5. The default is "text/javascript". JavaScript is the default scripting language in HTML5 and in all modern browsers.
Thank you for reading! This is the end of this article on "how to use js in html5". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.