Content Summary
When making a Web page, it is often necessary to use the JS code that the client can run on the page, so you need to add a reference. JS reference generally have type= "Text/javascript" and language= "JavaScript" two ways, but language this attribute in the HTML standard, is no longer recommended to use.
Specific instructions
In general, the JS reference method is:
Section ①
<script language= "Javascript" ></script>
Section ②
<script type= "Text/javascript" ></script>
So, what is the difference between the two references?
Insert JavaScript statements in HTML pages and use HTML <script>. <script> This tag has a property called type,type= "Text/javascript", which means that inserting <script> </script>; its internal code is a JavaScript statement.
Like what:
<script type= "Text/javascript" >
document.write ("Welcome to www.yiqixue.net!");
</script>
But when referring to someone else's JavaScript code, you see that <script> is not type= "Text/javascript", but language= "JavaScript".
Both of these methods can now be used to indicate that the code in <script> </script> is JavaScript. However, the language attribute is no longer recommended in the HTML standard of the user.
Although these two references are not wrong, but in the future when we make Web pages, we should use the ② method, as little as possible to use or discard the ① method.
Distinguish between type= "Text/javascript" and language= "JavaScript" in script