The origin of JS, the beginning of the 95 to check the server verification form data and gradually developed.
JS composition, 1 core (ECMAScript) 2 Document Object Model (DOM) 3 Browser object Model (BOM)
JS is an interpretive execution, a weak type, object-based, event-driven, cross-platform scripting voice
Objects include date objects, string objects, mathematical objects, a series of objects
Weak types do not differentiate between integers and decimals (relative to other programming speech) variables can store any type
Event-driven: event-based, such as mouse over (hover), mouse click (click, mouse Right-click) out of focus button bounce event
OnLoad Load Event
Cross-platform: windows, Linus
JS Useful, animation, interactive, game
Introduction of JS
JS is a. js suffix for JavaScript
1. Internal writing
2. External introduction (to add src, i.e. JS path)
Put it in the head, or the body.
JS syntax
1 Single-line comment
Single-line Comment
2 Quick-level annotations
/*
* Multi-line Comment
*/
Basic JS Pop-up window practice
Alert (1)
Problem: Path problem
Type= "Text/javascript"
Do not differentiate between single and double quotation marks
The basic syntax of JS
Each statement ends with a semicolon;
Strictly case-sensitive;
All symbols are in the English IME state
Console.log (' Hello ')
No meaning for console output, only for debugging
Javasript Direct quantities and variables
Direct Volume: Data values for direct use
Variable: The amount that can be dynamically changed
var a
The variable is made up of alphanumeric underscores, ¥, and cannot begin with a number
Use the Hump naming method, the first word lowercase
Output variable cannot be quoted
Case-sensitive to avoid duplication with system keywords
+ Meaning
1. Operator +
2. Connector connection string
Conversion of data types
1. Display Type conversions use function conversions
Number (' 123 ');//convert string to digital Nan:not a
String (123);//Convert a number to a string
parseint (' 123 ');//Convert a string to a number
parseint (3.14);//reserved integer digits
2. Implicit conversions
Number and string passed + after connection type is string
+ ' 12 ';//to take integer operations
Converts a Boolean value to a number
True--1
false--0
Number, except 0 is true;
A string that is true except for the byte-free;
Get element
JS time onload (window.onload) page when loading is complete
Get page element document.getElementById (); document, Element
Binding of basic events
OnClick event, Onmouseover,onmouseout event
JS three major Process Control
1, sequential structure
2. Select structure
3 Cycle structure
JS Syntax Basics