JavaScript Advanced Programming (3rd Edition) Summary of each chapter (1-8)

Introduction of the first chapter of JavaScript

The second chapter in HTML using JavaScript

The JavaScript inserted into an HTML page to use <Script>elements. Use this element JavaScript can be embedded into an HTML page, the script and marks are mixed together; may also include an external JavaScript file. And where we need to pay attention to are:

  • When including external JavaScript file, you must set the src attribute to point to the appropriate file URL. And this can be either file with the page that contains it is located on the same file server, the file may be in other domains.
  • All <script>the elements will in turn be resolved in the order they appear on the page. Does not apply in the case of async and defer properties, only in front of the finished parsing <script>after the code elements, later will begin parsing <script>the code elements.
  • Because the browser will first complete analytical NA defer attribute of <script>the code elements, and then parse the contents of the back, it is generally the <script>elements on the last page.
  • Use defer attributes can then execute the script after the document has been completely rendered. Delay script is always executed in accordance with their specified order.
  • Async attribute can be represented using the current script, without waiting for other scripts, do not clog document rendering. We can not guarantee asynchronous script executed in the order they appear on the page.
  • Use <noscript>element may specify alternate content displayed in the browser does not support script in. But in the case of a startup script, the browser does not display <noscript>any content elements.

Guess you like

Origin www.cnblogs.com/zppsakura/p/11442184.html