First, JavaScript
- Different from Java
- There are three components
- Core (ECMAScript)
- Document Object Model (DOM)
- Browser object Model (BOM)
var is the prefix that defines the data before adding three, pop-up
- Alert () Pop-up window, display content
- Confirm () Displays a dialog box with the specified message (the contents of the confirm) and the OK and Cancel buttons
- Prompt (text, value);
- Action: Displays a dialog box to prompt the user for input
- Text: Display plain text in a dialog box (non-HTML-formatted text)
- Value: Default input text (can be empty)
Iv. external inductive <script type= "Text/javascript" src= "Xxx.js" ></script> Five for finding data type typeof, throw find Type a below
VI. Basic Types
- Numeric only if the type is numeric
- String when double quotes are added
- True and False for Boolean types
- Empty type
- Object: Document
Vii. naming rules
- Case sensitive
- The first letter must be a letter, an underscore, or a dollar sign $
- Cannot contain spaces
- Cannot use canonical word
- A naming convention is typically preceded by a type
Eight, arithmetic symbols
- /division, a decimal point appears
- + for numeric values are added, for strings are stitching
- ! It can be used to reverse the judgment condition.
Nine, conditional statement--IF statement
- If-else statements
- Other wording: Judging the condition? Expression 1: Expression 2;
- When the judgment condition is set, the expression 1 is executed, and the expression 2 is executed.
Ten, + + 、--
- i++ is only added after the call.
- The ++i is added before the call
XI. format
- Window.onload = function () {、、、}
- Function content is not executed until the full page has been scanned
- When doing projects, it is best to introduce external files behind the body
- var oshow = document.getElementById ("show"); Get
- Oshow.onclick = function () {、、、} Click event
12, Continue&&break
- Continue end Current loop
- Break ends the entire loop
JS Basics 1