Zero Basic Introduction to Learning Web Development (HTML5&CSS3) 007<noscript><script>

 

0.<script>

HTML <script> tag

 

Definition and usage The <script> tag is used to define client-side scripts, such as JavaScript.

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

The required type attribute specifies the MIME type of the script.

Common uses of JavaScript are image manipulation, form validation, and dynamic content updates.

 

If <script> has both src reference content and inline content, the final display is the src reference content, and the inline content is ignored.

 

index.html

 

<script type="text/javascript" src="hi.js">document.write("i love lao wang too")</script>

 

hi.js

 

document.write("i love lao wang");

 

1. Delay script execution

use defer

 

<script type="text/javascript" src="patch.js" defer></script>

 

2. Execute the script asynchronously

use async

 

3.<noscript> 

HTML <noscript> tag

 

Definition and Usage

The noscript element is used to define alternative content (text) when the script is not executed.

This tag can be used in browsers that recognize <script> tags but do not support scripts within them.

 

Note: If the browser supports scripting, it will not display the text in the noscript element.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325293953&siteId=291194637