Today began to learn head first JavaScript, before the MU-class network and NetEase Cloud class have learned JavaScript, but still confused, so that may be their own foundation is thinner, so choose this simple and interesting introductory reading, hope to take me to get started, refueling!
Chapter I.
1.JavaScript transforms Web pages into interactive applications;
2 The .<script> label to the browser indicates that the following is Javascript,<script type= "Text/javascript" ></script> generally placed in
3. The browser has a JavaScript interpreter, JavaScript is an explanatory language, a scripting language, JavaScript has an event base, the event occurs when the code is triggered, JavaScript does not allow to read and write files on the user's hard disk;
4.onload event, triggered when the Web page finishes loading, the OnLoad property of the settings <body> tag can respond to the onload event (onload= ""); alert (' Text to display ') is a JavaScript built-in function that renders text messages in a popup dialog box, a function that performs common tasks and reuses JavaScript code that is packaged as a reusable module;
English Vocabulary accumulation:
Annual [' ænju?l] adj. yearly N. Annual, Yearbook; annual plants
ZIP code postcode; United States Postal Code; Postal Code; Zip
Finder n. Discovery; detector;
Calculate VI. To calculate VT. N. To calculate, predict, think;
Validate Vt. To confirm, verify, validate, or make effective.
onblur N. Loss of focus event; When the element loses focus
Virtual adj. [vi] fictitious; essentially, actually.
EventHandler event handlers
Delimiter n. [Gauge] Delimiter
Cursor n. cursors; (ruler's) [gauge] cursor, pointer
Interactivity N. interactivity; interactivity
Chapter II
1.JavaScript uses three basic data types: text, number, Boolean;
2. Variable data can be changed, may change during script execution-constant data is fixed;
3. Variable names should be unique and meaningful;
4. The data type can be set at the same time as the constant value, and the type of the variable value may change;
5. keyword var is used to create variables, and the keyword const is used to create constants;
6. Identifiers should be descriptive in order to easily identify data and to consider legality; start with: Letters, underscores, dollar signs $+ letters, underscores, $, number; the uniqueness of identifiers only exists but in a single script;
7. The lower case hump type is used to form variable names consisting of multiple words, used for variables and functions, and hump type (first letter capitalized) will only be used for objects;
8. Create constants must be initialized, a piece of data if there is no value, is undefined, undefined; As far as possible, it is best to do the initialization of variables;
9.nan:not a Number,nan is a non-numeric value, even if we think it will be a number;
10. String connection is very different from arithmetic addition, although it is used to add good (+); The form data is always stored as a string, regardless of the actual content;
English Vocabulary accumulation:
Constant N. [number] constants; constant adj. invariable;
Donut N. doughnut ring; loop coil (equals doughnut)
Unique adj. distinctive, rare; [number] unique, unique
Storage n. storage; warehouse;
Initializing initializing
Tax Rates
Countdown N. Countdown seconds
Identifier N. identifier, identity, surveyor, appraiser
CamelCase Camel Spelling Method
Cents cents
Validity n. [calculated] validity; correct; correctness
Integrity N. Integrity, integrity, honesty, integrity
Logical Entity Logical Entities
Validation N. Confirmation, approval, entry into force
Chapter III
1. Timer: setTimeout (timer code,timer delay), Word timer, setinterval () interval timer, delay time must be set in milliseconds;
Reload page: Location.reload ();
Clear Interval Timer: clearinterval (Timerid;
The 2.document object represents the Web page itself; the width and height of the Customer service window are stored in the Document.body.clientHeight and document.body.clientWidth features;
3. Page elements have style objects, width, height are the styles;
The client window is part of the browser window and is only responsible for rendering the Web page;
The width and height of the client are obtained through the body.clientwidth and body.clientheight characteristics of the Document object.
English Vocabulary accumulation:
Interval n. interval; spacing; intermission
Browser n. [meter] browser; the animal who eats the young leaves; the man who browses the book
Consistency N. [gauge] consistency; consistency; compatibility
Client n. [by] customer; customer; client
Fourth Chapter
1. Using the IF statement, conditionally run a piece of JavaScript code, the conditional test sentence of the IF statement, the result must be only true or false;
Use the If/else statement to conditionally run one or two snippets of JavaScript code;
Compound statements can be created by using compound statements, such as running multi-terminal JavaScript code running a single statement, enclosing multiple single statements in a pair of curly braces ({}), and compound statements that allow the action part of the IF/ELSE statement to perform multiple actions.
2. Comments suitable for reminders and unfinished code, add comments in the code to make the code easy to read;
Use a pair of slashes (//) to start a single line comment with a multiline comment starting with/* and ending with a/*;
Global variables are created at the script level, beyond any function or other block of code, and are present throughout the lifetime of the script, local variables are created (and destroyed) within the code block and can only be accessed within that code, and local variables are recommended because their access rights are tightly controlled.
The 3.if/else statement cannot be toggled in two other options.
English Vocabulary accumulation:
Pseudocode Pseudo-code
Comments Notes
Compound compound.
Nested nesting
Fifth Chapter
1.for loops can repeat a specific number of times for a piece of JavaScript code;
The increment (+ +) and decrement (-) operators provide a convenient way to update the loop counter;
Arrays can store multi-terminal data in the same place;
Although the array stores multiple pieces of information, there is only one variable name;
The index array is accessed through the numeric key of index.
Indexed arrays are good partners with loops, allowing us to handle the data in the array with a loop counter.
The 2.break statement ends the loop immediately, skipping any remaining loop code;
The Boolean logical operator allows you to create powerful true/false logic to facilitate decision-making;
While loop runs a piece of code all the time, as long as a test condition remains true;
Determines that the test condition can be affected by the while loop code to avoid an infinite loop.
3. Two-dimensional arrays let us store data row and column values in a tabular structure;
When accessing a piece of data in a two-dimensional array, you must set the index value of the row and column;
Nested loops can be used to process data in two-dimensional arrays;
Just like a generic array, a two-dimensional array can be created and initialized from an array object literal.
Sixth chapter
1. function allows us to convert big problems to small problems, small problems easier to solve;
The function provides a mechanism for separating the Script task, and then it can be combined with the reusable program code block;
A function is a great way to eliminate repetitive code, and the program code in the function can be reused as you wish;
Arguments allow you to pass data into a function as input to a given task;
The 2.return statement allows the function to return data to the calling function code;
When a function returns a piece of data, the data is placed in the code that invokes the function;
function can only return a piece of data;
The return statement is also not used with any data, and is simply used to end the function prematurely.
3. The callback function is called by the browser in response to events that occur outside of the script;
function references can assign functions like variables;
function references let us join the event handlers of JavaScript code design without altering the HTML code;
The function literal is a nameless function, which is handy when you don't need a function with a name.
Vocabulary accumulation:
Reference references
Reusability reusability
functionality function, [number] functional, functional
Duplicate repeat
of the literal text
Maintainability maintainability
Seventh Chapter
1. Each form field can be accessed as a JavaScript object;
There is a form attribute in the Form Field object, using an array to represent the field of the whole form;
The onblur event occurs when the input focus leaves a domain, which is a great way to trigger a data validation function;
Alert box is a very annoying method of notification of validation issues;
Passive verification aids intuition, but also less harassment of users;
The string length attribute displays the number of characters that the string contains.
2. Regular expressions match the text in a string with a pattern, and the regular expression must be surrounded by a slash;
In addition to the general text, the regular expression is also established by the meta-character and qualifier, which provides fine control over the matching of text patterns.
JavaScript supports regular expressions through built-in RegExp objects, but regular expressions are usually built as literal, so this object is seldom seen;
The test () method of the RegExp object is used to apply the regular expression pattern detection to the string.
Vocabulary accumulation:
Characters characteristic description
Validate confirm, verify, confirm, make effective
Digits Digital
Regular expression Regular expressions
Metacharacter Meta-characters
A quantifier quantifier; a quantitative word; a person who is proficient in computing.
Eighth Chapter
1.innerHTML is not the standard of the World Wide Web, but this feature can access all content stored within the element;
DOM provides a standardized mechanism for accessing and modifying Web page data;
Dom View Web page as a hierarchical tree of associated nodes;
Using DOM to change the content of the Web page, you need to remove all child nodes under the element, and then create and attach a new sub-node containing the new content;
2. By changing the whole style class of the node, classname the characteristics of the node to achieve a dramatic style change;
The style node features a small number of style changes by accessing a single style attribute of the node;
CSS style classes are completely unrelated to the JavaScript class, and they are completely different things;
Page elements can be dynamically displayed or hidden using the visibility style attributes of the element object.
3. Use the CreateElement () method of the Document object to create any HTML element;
To add text content to a new element, you must create a text content sub-element and attach it to the element;
By carefully adding and removing nodes from the DOM tree, the Web page can be disassembled and reorganized at will.
Vocabulary accumulation:
Irritating stimulated by
Frazzled tired.
Panicked panic
Maddening crazy.
Nineth Chapter
1. The object is a special data structure, combining the data and the action of the data according to the program code;
In fact, objects are simply variables and functions that are combined into a single structure;
When a variable is placed in an object, it is called a method;
When referencing attributes and methods, provide the name of the object, followed by the dot operator, followed by the name of the attribute or method.
2. Standard JavaScript Date object that expresses the moment in milliseconds;
Standard JavaScript objects have some methods to access the time values of each part;
Date objects are smart enough to be able to arithmetic dates and compare dates;
Same as most objects (except for string objects), date objects are created with the new operator.
The 3.toString method is used to convert any object to a text representation;
Arrays and strings are actually objects, relying on JavaScript's standard object array and string to provide methods and data storage;
The sort () method of the array object can arrange the array in any order;
The IndexOf () method of the string object searches for another string within the string, returning the index position of the search target.
Vocabulary accumulation:
Object-oriented Object-oriented
Organizational Object Organization objects
pseudorandom pseudo-Random
Conundrum Puzzles
Tenth Chapter
1. The class is the description of the object, and the instance is the actual object, which is created according to the object description;
The class outlines the properties and methods of the object, and the instance just puts the real data in the feature for the method to use;
The keyword this is used to access an instance from within the program code of the instance itself;
The prototype object allows the method to be stored in the class so that the instance does not unnecessarily replicate the program code.
Vocabulary accumulation:
Encapsulate Package
Instance instances
Prototype prototypes
11th Chapter
1. Although most browsers provide error consoles (documenting JavaScript errors), they are not completely accurate and you cannot trust them all;
Although browsers often produce incomplete error messages, they usually provide clues to the problem;
Enclosing the curly braces of the code block is a common defect origin---Please be careful, be sure to confirm that the starting and closing brackets appear in pairs;
Everyone makes simple typing mistakes, but it's not always easy to find them.---Be sure to check the name of the identifier.
2. Grammatical errors are related to code that violates the language rules of JavaScript and is usually captured by the JavaScript interpreter;
The string must be carefully enclosed in a pair of quotes or apostrophes;
When you include JavaScript code in the properties of an HTML event handler, you should carefully mix quotes and apostrophes;
For "Observing variables in script", the alert box provides a beginner but useful option;
Common mistake: accidentally write = = in the test condition.
3. Make sure that the brackets appear in pairs;
Make sure the braces that surround the code block appear in pairs---carefully indent the code to help maintain the pair of curly braces;
Try to avoid the wrong identifier name---variable and function name if inconsistent, it is easy to cause large problems;
Use quotation marks and apostrophes to maintain consistency of usage and, if necessary, mix the two symbols in HTML attributes;
Use the escape character to encode a character in a string that has a special meaning, such as a quotation mark (\ ") or an apostrophe (\ ');
Never try to misuse = when you want to use = =. JavaScript may not treat this as a mistake, but your program code will work differently than you think;
Determines that the object has been created before it is accessed---primarily on page elements, and page elements are created just before the OnLoad event triggers;
Do not take the same name for local variables and global variables, because local variables will cloak global variables, causing some unpredictable behavior.
Vocabulary accumulation:
Syntax Error syntax errors
Runtime error run-time errors
Logic Error Logical errors
Shaded the color of the dark
Investigators researcher
Average average
Calculate calculation
Classification classification
Intelligence Intelligence
Superior Excellent
Genius Genius
Comments Notes
Typo typographical errors
Quotes quotation marks
Curly braces Curly Braces
12th Chapter
1.XMLHttpRequest objects are standard objects for processing AJAX requests, but they are a bit of a bad use;
The custom Ajaxrequest object provides a convenient way to use Ajax, but does not need to face the XMLHttpRequest object directly;
Ajax requests must be one of two types, get or post, type by the data sent to the server, but also based on how the data affects the server decision;
Sent () sends out an AJAX request, causing a response.
Vocabulary accumulation:
Dynamic Dynamics of
Conversation dialogue
Release releases
Director
Summary Summary
The asynchronous asynchronous
Response response
Complexity Complex
Store Storage
Ready State Readiness
Status status
Entry Enter
Head first JavaScript