In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use js in html5. It is very detailed and has a certain reference value. Friends who are interested must read it!
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:
External script:
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:
● 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.
The above is all the content of this article entitled "how to use js in html5". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.