Introduction to JavaScript Basics

Source: Internet
Author: User

first, what is1. Concept

JavaScript is a literal-translation scripting language, which is a dynamic type, a weak type, a prototype-based language, and a built-in support type.

JavaScript is also a client-side scripting language that is Object-and event-driven and has relative security.

Its interpreter, known as the JavaScript engine, is widely used as a scripting language for the client, and is used in HTML (an application under the standard Universal Markup Language) to add dynamic functionality to an HTML Web page.

3. Composition

(1) ECMAScript, which describes the syntax and basic objects of the language.
(2) Document Object Model (DOM), which describes methods and interfaces for handling Web page content.
(3) A Browser object model (BOM) that describes the methods and interfaces that interact with the browser.

4. Features

(1) is an explanatory scripting language (the code is not precompiled).
(2) mainly used to add interactive behavior to HTML pages.
(3) Can embed HTML page directly, but write a separate JS file is advantageous to the separation of structure and behavior.

second, what to do

1. Embed dynamic text in HTML page
2. Responding to browser events
3. Read and write HTML elements
4. Validate data before data is submitted to the server
5. Detect visitor's browser information
6. Control of cookies, including creation and modification, etc.

third, how to do

Here is a simple javascript Hello world:

[HTML]View Plaincopy
  1. <! DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title> Simple JavaScript Hello World</title>
  5. <script type="Text/javascript">
  6. document.write ("Hello, world!"); Display directly within the browser window
  7. Alert ("Hello, world!"); Pop-up window display
  8. Console.log ("Hello, world!"); In console, you need to start the developer console
  9. </Script>
  10. </head>
  11. <body>
  12. HTML content ...
  13. </Body>
  14. </html>


Or in the browser's address bar (location bar), use javascript: to interactively represent:

Javascript:alert ("Hello world!");

Iv. Expansion 1. The relationship between JavaScript and Java

JavaScript is similar to the Java name, but Java was developed by Sun Microsystems. These two languages are developed on the basis of C language, which is somewhat similar in syntax, but is completely different. It's like the difference between English and German.
JavaScript was originally called LiveScript in the development phase, and since Java became popular at the time, and Netscape company and Sun Company had technical cooperation, it became the name of JavaScript.

2. The relationship between JavaScript and DHTML

DHTML (Dynamic HTML, animated HTML) is supported starting with Internet Explorer 4.0 and Netscape Communicator 4.0. It's not really a new language, it's just an integration of HTML, CSS, and client-side scripting, where a page includes html+css+javascript (or other client script), where CSS and client-side scripts are written directly on the page rather than linked files.

DHTML is not a technology, a standard or a specification, but a combination of existing web technologies and language standards, creating a Web design concept that can still transform page element effects in real time after downloading. JavaScript is the core technology in DHTML, so keep it in your hands.


Introduction to JavaScript Basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.