First, JavaScript overview
JavaScript Concepts
-JavaScript is an interpreted scripting language that runs in JavaScript interpreter/engine
-JavaScript interpreter as the operating environment of JS script, like the next two rendering methods
-Standalone JavaScript interpreter for installation;
-JavaScript interpreter embedded in the browser kernel;
-The main browsers installed in PCs, tablets, mobile phones, and set-top boxes all support JavaScript
JavaScript history
-In 1992, Nombas developed a scripting language scriptease for its own Cenvi software, which can be embedded in Web pages
-in 1995, Netscape company developed another client-side scripting language livescript for its own Navigator2.0 browser, renamed JavaScript for the fashion, but it has nothing to do with Java.
-in 1996, in order to enter the browser market, Microsoft launched a JavaScript clone version in IE3.0 browser called JScript
-in 1997, JavaScript 1.1 was presented to ECMA as a draft, with various manufacturers pulling out of the ECMA-262 standard, defining a new ECMAScript standard scripting language, and major browser manufacturers starting to "work" to ECMAScript as the standard and target for implementation
-The full JavaScript language consists of three parts:
-Core (ECMAScript)
-Document Object Model (dom,document)
-Browser object Model (Bom,browser)
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7D/ED/wKioL1bzYIKi9NRFAADQHIB6ql0077.png "title=" Web.png "alt=" Wkiol1bzyiki9nrfaadqhib6ql0077.png "/>
JavaScript Features
-code can be written using any text editing tool, syntax similar to C and Java
-No need to compile, interpreted by JavaScript engine execution
-Weakly typed language
-Based on object
-Use
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7D/ED/wKioL1bzYPOBcPi6AACjbIp8s8M941.png "title=" Web.png "alt=" Wkiol1bzypobcpi6aacjbip8s8m941.png "/>
Second, JavaScript basic syntax
Browser kernel
-the browser core is responsible for rendering the content of the page, consisting mainly of two parts:
-Content Typesetting engine-----parsing HTML/CSS
-Script Interpretation engine-----parsing JavaScript
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7D/ED/wKioL1bzaN_D01UiAAH8cZbKOn0576.png "title=" Web.png "alt=" Wkiol1bzan_d01uiaah8czbkon0576.png "/>
Build JavaScript Runtime Environment
-Install a standalone JavaScript interpreter
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7D/ED/wKioL1bzaHWxx6rWAAGUtIDQ3vE263.png "title=" Web.png "alt=" Wkiol1bzahwxx6rwaagutidq3ve263.png "/>
-Use the JavaScript interpreter embedded in the browser kernel
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7D/F0/wKiom1bzaB_ypICbAAB4MaAOw8k235.png "title=" Web.png "alt=" Wkiom1bzab_ypicbaab4maaow8k235.png "/>
The first JavaScript program
-Way One: Use the standalone JavaScript interpreter
-You can enter the script to execute in one line and execute
-You can also write multiple lines of script to execute in a text file, batch execution
-Way Two: Use the embedded JavaScript interpreter in the browser kernel
-Enter the script directly in the console and execute
-Embed the JS script in the HTML page to execute
-HTML element events
-<script> Elements
-External script file
HTML element Events
-Script statements to be executed are written directly in the <body> tab
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7D/F0/wKiom1bzaMXh6msFAAD51041C4c908.png "title=" Web.png "alt=" Wkiom1bzamxh6msfaad51041c4c908.png "/>
<script> elements
-Multiple statements can be executed in an internal script block
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7D/F1/wKiom1bzaU-xNIJSAAHoKBnpHQA160.png "title=" Web.png "alt=" Wkiom1bzau-xnijsaahokbnphqa160.png "/>
External script files
-Write JavaScript code to a separate file and save it as a file with the suffix. js
-For plain text files
-No need to include <script> tags in the file, write JS code directly
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7D/ED/wKioL1bzazfiOlAFAAETLvDYEPs415.png "title=" Web.png "alt=" Wkiol1bzazfiolafaaetlvdyeps415.png "/>
-Reference the. js file in the HEAD of the HTML page
-Add <script> tags to
-Set the "src" attribute of the <script> tag to develop the URL of the JS file
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7D/EE/wKioL1bzbWLxbf9JAAEABlbIhqM881.png "title=" Web.png "alt=" Wkiol1bzbwlxbf9jaaeablbihqm881.png "/>
Third, JavaScript debugging
JavaScript Code Error
-interpreted language, if a line of code is wrong, the interpreter terminates this line
-but does not affect subsequent block execution, and subsequent parsing of HTML elements
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7D/EE/wKioL1bzfjWCfQksAAEUgdUneeE677.png "title=" Web.png "alt=" Wkiol1bzfjwcfqksaaeugduneee677.png "/>
debugging features of the browser
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7D/EE/wKioL1bzf5mxivyIAAKJuXCGtv4756.png "title=" Web.png "alt=" Wkiol1bzf5mxivyiaakjuxcgtv4756.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7D/F1/wKiom1bzftvQGTrKAAJl_872QTM383.png "title=" Web.png "alt=" Wkiom1bzftvqgtrkaajl_872qtm383.png "/>
Chrome Control Console
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7D/F2/wKiom1bzgFyw_k8eAAKQbF7bdIo666.png "title=" Web.png "alt=" Wkiom1bzgfyw_k8eaakqbf7bdio666.png "/>
Iv. JavaScript Syntax specification
Writing JavaScript Code
-statement----will be interpreted by the JavaScript engine to execute the code
-consists of an expression, a keyword, an operator;
-Case sensitive;
-End with a semicolon or line break;
-note----code executed by the JavaScript engine is not interpreted
-Single Comment://
-Multiline Comment:/* */
Case sensitive
-Case sensitivity in JavaScript programs
-UserName, UserName, UserName are different
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7D/EE/wKioL1bzgu2DsyHuAAC0DvvmdJk154.png "title=" Web.png "alt=" Wkiol1bzgu2dsyhuaac0dvvmdjk154.png "/>
Summary: This chapter covers JavaScript (overview, basic syntax)
This article from the "Technical Exchange" blog, declined reprint!
JavaScript Basics -1 JavaScript (overview, basic syntax)