Getting started with JavaScript
I. What is it? 1. Concept
JavaScript is a literal-literal scripting language. It is a dynamic, weak, prototype-based language with built-in support types.
JavaScript is also a client scripting language based on object and event-driven and relatively secure.
Its Interpreter, called the JavaScript engine, is a part of the browser and is widely used in the script language of the client. It was first used on HTML (an application under the standard General Markup Language) web pages, it is used to add dynamic functions to HTML webpages.
2. Overall Structure
3. Composition
(1) ECMAScript describes the syntax and basic objects of the language.
(2) Document Object Model (DOM), which describes the methods and interfaces for processing webpage content.
(3) browser Object Model (BOM), which describes the methods and interfaces for interacting with the browser.
4. Features
(1) It is an interpreted scripting language (code is not pre-compiled ).
(2) It is mainly used to add interactive behaviors to HTML pages.
(3) HTML pages can be directly embedded, but writing a separate js file facilitates separation of structure and behavior.
Ii. What to do
1. Embed dynamic text on HTML pages
2. Respond to browser events
3. read and write HTML elements
4. verify the data before the data is submitted to the server
5. check visitor's browser Information
6. Control cookies, including creation and modification
Iii. How to do it
The following is a simple JavaScript Hello World ︰
<! Doctype html>
Or use javascript: in the browser's address bar (location bar) for interaction:
Javascript: alert ("Hello world! ");
Iv. Extension 1. Relationship between JavaScript and Java
JavaScript is similar to Java, but Java is developed by Sun Microsystems. These two languages are developed on the basis of the C language. The syntax is somewhat similar, but they are completely different. It is like the difference between English and German.
JavaScript was originally called LiveScript in the development stage. Since Java became popular at that time, and Netscape and Sun joined the technical cooperation, it became the JavaScript name.
2. Relationship between JavaScript and DHTML
DHTML (Dynamic HTML, Dynamic HTML) is supported from Internet Explorer 4.0 and Netscape Communicator 4.0. In fact, it is not a new language. It is just an integration of HTML, CSS, and client scripts. That is, a page contains html + css + javascript (or other client scripts ), css and client scripts are directly written on the page rather than related files on the link.
DHTML is not a technology, standard, or specification, but an integrated application of existing web page technologies and language standards, create a web design concept that can change the page element effect in real time after the download. JavaScript is the core technology in DHTML.