Javascript Basi...LOGIN

Javascript Basics Tutorial - Introduction to Javascript

javascript

## JavaScript is a literal scripting language. It is a dynamically typed, weakly typed, prototype-based language with built-in support for types. . Its interpreter is called the JavaScript engine, which is part of the browser and is widely used in client-side scripting languages. It was first used on HTML (an application under Standard Universal Markup Language) web pages to add dynamic functions to HTML web pages. .

In 1995, it was first designed and implemented on the Netscape Navigator browser by Brendan Eich of Netscape. Because Netscape was working with Sun, Netscape management wanted it to look like Java, hence the name JavaScript. But in fact its grammatical style is closer to Self and Scheme.

In order to gain technical advantages, Microsoft launched JScript, and CEnvi launched ScriptEase, which can also run on the browser like JavaScript. In order to unify specifications, JavaScript is also called ECMAScript because it is compatible with the ECMA standard.


##Components

1. ECMAScript describes the syntax and basic objects of the language.

2. Document Object Model (DOM), which describes the methods and interfaces for processing web content.

3. Browser Object Model (BOM) describes the methods and interfaces for interacting with the browser.

javascript Composition:

321_副本.png##Basic features


JavaScript is a scripting language that belongs to the Internet. It has been widely used in Web application development and is often used to add various elements to web pages. Dynamic functions provide users with smoother and more beautiful browsing effects. Usually JavaScript scripts realize their functions by embedding them in HTML.

It is an interpreted scripting language (the code is not precompiled).

Mainly used to add interactive behaviors to HTML (an application under Standard Universal Markup Language) pages.

It can be directly embedded into HTML pages, but writing it as a separate js file is beneficial to the separation of structure and behavior.

Cross-platform features, with the support of most browsers, can run on multiple platforms (such as Windows, Linux, Mac, Android, iOS, etc.).

                                        Javascript scripting language, like other languages, has its own basic data types, expressions and arithmetic operators and the basic program framework of the program. Javascript provides four basic data types and two special data types for processing data and text. Variables provide a place to store information, and expressions can complete more complex information processing.

Daily use

1. Embed dynamic text in HTML pages.

2. Respond to browser events.

3. Read and write HTML elements.

4. Validate data before it is submitted to the server.

5. Detect the visitor’s browser information.

6. Control cookies, including creation and modification.

7. Server-side programming based on Node.js technology.

history

It was originally designed by Brendan Eich of Netscape. JavaScript is a registered trademark of Oracle Corporation. Ecma International developed the ECMAScript standard based on JavaScript. JavaScript can also be used in other situations, such as server-side programming. The complete JavaScript implementation consists of three parts: ECMAScript, Document Object Model, and Browser Object Model.

Netscape originally named its scripting language LiveScript. Later, Netscape changed its name to JavaScript after cooperating with Sun. JavaScript was originally inspired by Java and was designed. One of the purposes is to "look like Java", so there are similarities in syntax, and some names and naming conventions are also borrowed from Java. But the main design principles of JavaScript are derived from Self and Scheme. The similarity in names between JavaScript and Java was the result of Netscape reaching an agreement with Sun Microsystems for marketing reasons at the time. In order to gain a technical advantage, Microsoft launched JScript to compete with the JavaScript scripting language. For interoperability, Ecma International (formerly the European Computer Manufacturers Association) created the ECMA-262 standard (ECMAScript). Both are implementations of ECMAScript. Although JavaScript is promoted and advertised as a scripting language for non-programmers rather than as a scripting language for programmers, JavaScript is very rich in features.

In the early days of development, the standard of JavaScript was not yet determined. During the same period, there were three pillars: Netscape's JavaScript, Microsoft's JScript and CEnvi's ScriptEase. In 1997, under the coordination of ECMA (European Computer Manufacturers Association), a working group composed of Netscape, Sun, Microsoft, and Borland determined a unified standard: ECMA-262.

Features

The JavaScript scripting language has the following features:

(1) Scripting language. JavaScript is an interpreted scripting language. Languages ​​such as C and C++ are compiled first and then executed, while JavaScript is interpreted line by line during the running of the program.

(2) Based on objects. JavaScript is an object-based scripting language that can not only create objects but also use existing objects.

(3)Simple. The JavaScript language uses weakly typed variable types and does not impose strict requirements on the data types used. It is a scripting language based on Java's basic statements and controls, and its design is simple and compact.

(4)Dynamic. JavaScript is an event-driven scripting language that can respond to user input without going through a Web server. When visiting a web page, JavaScript can directly respond to these events when the mouse is clicked, moved up or down, or moved around the window.

(5) Cross-platform. The JavaScript script language does not depend on the operating system and only requires browser support. Therefore, after writing a JavaScript script, it can be brought to any machine for use, provided that the browser on the machine supports the JavaScript scripting language. Currently, JavaScript is supported by most browsers.

Unlike server-side scripting languages, such as PHP and ASP, JavaScript is mainly used as a client-side scripting language to run on the user's browser and does not require server support. Therefore, in the early days, programmers preferred JavaScript to reduce the burden on the server, but at the same time it also brought about another problem: security.

As servers become more powerful, although programmers prefer scripts running on the server to ensure security, JavaScript is still popular for its cross-platform and easy-to-use advantages. At the same time, some special functions (such as AJAX) must rely on Javascript to be supported on the client side. With the development of engines such as V8 and frameworks such as Node.js, and their features such as event-driven and asynchronous IO, JavaScript is gradually used to write server-side programs.

Programming

JavaScript is a scripting language whose source code does not need to be compiled before being sent to the client for running. The character code in text format is sent to the browser for interpretation and execution by the browser. The weakness of literal translation languages ​​is that they are less secure, and in JavaScript, if one cannot run, then the following languages ​​cannot run either.

Version

JavaScript has been submitted to ECMA by Netscape to formulate a standard, called ECMAScript, standard number ECMA-262 . The latest version is currently ECMA-262 5th Edition. The implementations that comply with the ECMA-262 3rd Edition standard are

##1. Microsoft's JScript.

2.Mozilla’s JavaScript-C (C language implementation), now named SpiderMonkey

3.Mozilla’s Rhino (Java implementation)

4.Digital Mars company’s DMDScript

5.oogle’s V8

6.WebKit



##



    


Next Section
<script> alert("欢迎学习javascript") </script>
submitReset Code
ChapterCourseware