The first three chapters of the basic JavaScript tutorial (version 6th)

Source: Internet
Author: User

The translation of JavaScript & Ajax for the Web, sixth edition is generally fluent, but the translator still has some inattentive translation problems. In addition, Why don't people post the beginning JavaScript with Dom scripting translation first?
Chapter 1 Understanding Javascript
1.3 origins of JavaScript
Although JavaScript and Java are affected, the two are actually different, and the name is Netscape's marketing method, because it borrowed the Java pipeline that began to become popular at that time.
1.7 combined (snap-together) Language
Javascript is an object-oriented language.
Every item in the document tree is treated as an object. The object has attributes and methods, and the object, attributes, and methods are combined with the dot syntax.
1.11 compile JavaScript-friendly html
To manipulate objects in a document using JavaScript, You need to compile XHTML compliant with web standards.
Separation of structure, representation, and Behavior
Chapter 2
2.1 where to put the script
The last line on page 16th:
There's no need to addLanguageOrTypeAttributes to
ClosingScriptTag.
There is no need to use language or type in the end tag, but it is necessary to use type in the start tag to replace language.
The language attribute of the script tag has been deprecated in XHTML and will not be supported by W3C in later versions. Therefore, it can be skipped in the script.
2.3 use external scripts
The script contains a line of code:
Window. onload = writemessage;
Window. onload is an event handler. An equal sign is followed by a function name: writemessage.
The writemessage function is run once the window is loaded.
Both document. Write () and innerhtml attributes insert information into the HTML page. Although innerhtml has been abandoned by W3C, it is more common and the easiest way to work across browsers.
2.9 link improvement using JavaScript
Row 5th: "as usual, HTML contains the ID that javascript can use in the link tag ". The link here is suggested to be translated as "Link ".
2.10 process reference page
Reference page.
31st page, 2nd rows:
Script 2.14. The empty
<H2>Tag has an ID for use by the referrer page JavaScript.

The <H2> label empty in script 2-14 contains an ID for reference page JavaScript.
Chapter 3 language basics
3.1 repeated cycles
Page 34th Chapter 3.1 line 4th: In JavaScript, loops become a vital part of your scripting toolbox.
Loop is a very important part in the Script Programming toolbox of JavaScript.

Three Components of a loop:
Initialization
Restrictions
Increment
In the limitation section of the loop, if the variable is 10 and the value of the JavaScript programming language is from 0 to 9 (smaller than the variable), the code in the loop will run 10 times.

3.3 detecting objects
This solves a problem that has been confusing for a long time. When reading the Javascript getting started classic by the mail, you can see:
If (document. getelemetbyid)
At that time, I had no idea why I should write it like this. Now I understand: Checking document. whether the getelementbyid object exists and can be understood by the browser. It is interpreted as true and continues to be executed. Otherwise, it is set to false and the else statement is executed.
Detection is recommended ".
Object detection is considered to be the best way to solve the problem of cross-browser JavaScript. In actual environments, it is important to first check whether the browser can process objects, instead of taking it for granted that the browser can handle it.
3.4 process Arrays
The index in the 42nd page array is translated as an index in this book, while the index is translated as a subscript in Javascript DOM Script Programming. There is information on the Internet that "Index" refers to the subscript in the numerical form of an array.
The translator seems to be a writer who is engaged in English translation, and may be just half a bucket of water for CSS like the translator in the CSS practice manual. This is his blog:

Http://blog.sina.com.cn/u/1263026645

In the past, his translations were well-known on the Internet, "proficient in CSS", and most of these books were read by Web Front-end developers engaged in web page reconstruction.

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.