This series of blogs is a summary of my reading of the book "JavaScript DOM Programming Art". The partial theory of the front part of the book is the exact words, feel the need to record, to facilitate their own pages, but also hope to read this blog to provide some help, so
If you have read this book, Hope not to spray small "plagiarism", in fact, I do not bother to knock these words also want to simple rough on the ground code, but only practice no theory is not easy to understand, in order to avoid misleading, the "copy" of the place or to "copy", haha ~ ~
First, the origin of JavaScript
JavaScript was developed by Netscape Corporation and Sun Corporation. Before JavaScript appeared, a Web browser was nothing more than a simple software that could display hypertext documents. After the advent of JavaScript, the interactivity of the Web page has been greatly improved.
The first version of JavaScript, JavaScript1.0, appeared in the Netscape Navigator2 Browser launched in 1995.
When JavaScript1.0 released, Netscape Navigator dominated the market, ie played the role of Chaser. Microsoft released its own VBScript language when it launched the IE3, and, in the name of JScript, published the first version of JavaScript as a
Quickly followed the pace of Netscape. In the face of Microsoft's competition, Netscape and Sun's joint ECMA (European Computer Manufacturing Association) non-JavaScript language is standardized. Then came the ECMAScript language, which is another name for the same language.
Although the name ECMAScript is not popular, the JavaScript that people are talking about is actually ECMAScript.
By the year 1996, JavaScript, ECMAScript, and JScript have taken their footing. Netscape and Microsoft support JavaScript1.1 in their respective browsers to varying degrees.
Second, DOM
The main content of this book is the art of DOM programming, so let's start with a ballpark understanding of the DOM. Simply put, Dom is a set of methods for abstracting and conceptualizing the contents of a document. The DOM is shorthand for the Document Object model,
So words too literally can guess. This is a way to treat a document as an object. Since it is an object, it should have attributes, so JavaScript's DOM programming is actually getting properties and manipulating them through document objects.
Third, the browser war
1. DHTML
DHTML is the "Dynamic HTML" abbreviation. DHTML is not a new technology, but a term that describes the combination of HTML, CSS, and JavaScript technologies. The implications include the following three areas:
(1) Using HTML to mark Web pages as various elements
(2) Use CSS to set element style and display location
(3) Use JavaScript to manipulate pages and change styles in real time
2. Conflicts between browsers
Netscape Company's DOM uses proprietary elements called layer layers. Layers have unique id,javascript that need to be referenced as follows:
document.layers[' element '
In IE, this element should be referenced as follows:
document.all[' element '
There are many differences like this, which leads developers to know what browser the script will run on when writing Dom script code. Also, in order to make sure that the corresponding code is available to different browsers correctly, write some code to explore the
What kind of browser is the client running?
IV. Custom Standards
At the same time that browser vendors are marketing wars with Dom for developing weapons, the company has introduced a standardized DOM with the benefits of everyone. Happily, browser makers are also able to put aside hostility and create new standards by working with the web.
and completed the "first level Dom" with October 1998. Browser vendors are only interested in how the Web is controlled via JavaScript, and the standardized Dom introduced by the website allows any programming language to be written in any one of the markup languages
Out of any one document into
The line control.
1, outside the browser considerations
Dom is an API (application programming Interface), a basic convention that is recognized by all parties, such as Morse code, the International time zone, and the periodic table of chemical elements, which are standard in different scientific fields. The so-called inadequate surrounding area, Dom is such a standard, open
The developer must follow this set of standards.
The definition of the DOM is: "An interface that is independent of the system platform and programming language, where programs and scripts can dynamically access and change the content, structure, and style of the document." The standardized DOM introduced by the world wide market, in terms of independence and scope of application
Are far beyond the proprietary DOM introduced by browser vendors, thus becoming a standard in the field of programming languages.
2, the end of the browser war
Web designers are the most influential browser wars. Cross-browser development is their nightmare, in addition to the differences between JavaScript, Netscape and IE in the support of the CSS is also very different, resulting in writing support for both browser style is a
Black Art. As a result, browser vendors ' behavior has been fiercely objected to by a group called Web Standards Program, which encourages browser manufacturers to adopt the standards set and recommended by the Internet, which are drafted with the help of browser vendors
and perfect standards, this makes the browser product support for Web standards has been greatly improved.
3. A new starting point
Today's browser market is completely different from what it used to be. First of all, Netscape has ceased to exist, and some rookies have risen rapidly, so far the mainstream browsers in the market are Chrome, Firefox, opera and ie. and almost all browsers
The built-in support for the DOM has finally enabled the "write once, run everywhere" dream, and as long as you follow the DOM standard, developers can be confident to do it.
The above is the first chapter of the content, through the introduction of JavaScript script caused by the browser war, lead to the industry-level DOM standard proposed by the World Wide Web, further introduce the meaning of the DOM, and finally back to the end of the browser war illustrates the DOM standard
Importance, it can be seen that the browser facilitates the progress of the JavaScript language, so before learning JavaScript to have a certain understanding of the browser, of course, I am talking about the browser's underlying technology, such as parsing, recognition language and so on.
JavaScript DOM Programming Art Chapter I: A brief History of JavaScript