JAVA is a Web page inside the script used to meet, very powerful language.
The basic syntax is divided into:
Comment syntax, 1 single-line comment//, 2 good comment/**/
Output syntax: (information) alert-Popup information
confirm--Popup A dialog box with user Exchange
Prompt---Pop up a dialog box that lets the user enter
Embed JS code: try to write down
<script type= "Text/javascript" > </>
Basic knowledge of the program: All characters are English half-width; In most cases, a semicolon is added to the end of each statement; Add a newline after each piece of code is finished;
Data type: 1> strongly typed language: data stored in programs, Spring village name is called variable
2> Weakly typed language: Data-type variables are required when storage is available
3 "type int integer; fioat single-precision decimal, double-decimal, decimal-decimal, char-character;
string-string;
bool-Boolean-True True false-fake
DateTime Date Event Type
<display:none> Hide an element <visibility:hidden> also hide an element
<display:block> Display <visibility:visible> Display
The difference between <display> and <visibility> is that:<display> does not occupy position <visibility> hidden post position
When the two <div> overlap, internal <div> is displayed when the internal <div> is larger than the external one.
<overflow:hidden> out of section hidden
<scroll> out-of-section scroll bar display
Transparent: opacity:0.5; -moz-opacity:0.5; Filter:alpha (OPACITY=50) Three of these are used together in order to be compatible with a variety of browsers
Fillet: border-radius:5px (can adjust pixels to change the fillet size)
Transparent: box-shadow:0 0 5px 5px White;
(Distance from x-axis) (Distance from y-axis) (How far the shadow is from the Div) (Thickness of Shadow) Color
JS Basic Grammar, Program basic knowledge, data type, operator expression, statement : JS code use principle: try to lean down
Basic knowledge of the program:
① all characters are half-width English;
② in most cases, a semicolon is added to the end of each statement;
③ each piece of code at the end of the add line;
④ write the program must be back and forth (example: when the front of the parentheses, the back must also have parentheses to end)
Basic syntax:
⒈ comment Syntax: single-line Comment://Multiline Comment:/* */EMBED format <script type= "Text.javascript" > try to lean down
⒉ output Syntax: ①alert (informational hint, popup): Pop-up window.
②confirm (pop-up info): POPs up a dialog box that interacts with the user
③prompt (pop-up info): POPs up a dialog box for the user to enter
Data type:
⒈ variables: Data is stored in the program, and the stored name is called a variable. In general, variables are used to store data. (generic type Var, can store other types of values casually)
① strongly typed languages: Classified archives, stored in corresponding data type variables
② Weakly typed languages: Regardless of what type of data is entered, the storage is the same, and in this type language, the type is automatically converted.
⒉ Storage Type:
① Number class: ⑴ Shaping (integer): Int⑵ single precision fractional: Float⑶ double decimal: Double⑷ decimal: Decimal
② Currency Type: money
③ Character: Char
④ string: String
⑤ Boolean (can only store two states, logic is true or false): 1, true: True 2, False: False
⑥ Date Time Type: datetime
⒊ variable definition:
var a = 10;
var B = 5;
var c = a+b;
Alert (c) alert: output
If you define a decimal or integer variable, the value after the equal sign is written directly
If you define a variable of a string, the string after the equal sign must be enclosed in double quotation marks (single quotation marks)
If you define a Boolean, write directly after the equals sign (example: var sex (gender) = true;)
⒋ Conversion Mode:
To Integer: parseint (conversion content); Parse
Operator expression:
⒈ mathematical operators: +-*/(in strongly typed languages, integers/integers must be equal to integers)%
⒉ logical operator: &&: and (Multiple conditions must be set up simultaneously) | |: or (to satisfy one of these conditions can be established)!: Non-
⒊ string concatenation: Also with + (+ on both sides as long as there is one side of the string is stitching)
⒋ ternary operator: var a = 8;
var B = 5;
var c = a==b? " A equals B ":" A is not equal to B "
Conditions (Show content when set up) (Show content when not established)
The front can also write true or False
⒌ comparison operator: Determines whether equals: = = judgment is not equal to:! = To determine whether the value is greater than:> is less than:<
Judge whether Daewoo equals: >= judgment is less than equals: <=
Statement:If switch
⒈ sequential statements: Execute from top to bottom, plus semicolons at the end.
⒉ Branch Statement: Let the program execute different code depending on the condition.
Example: var a = 10;
var B = 5;
Conditions
Example: if (a==b)
{
Alert (the code executed when the condition is met) such as ("123")
}
else if (a>b) means so if
{
Alert (code executed when the else if condition is met) such as ("789")
}
else: Then
{
Alert (code executed when the condition is not met) such as ("456")
}
Example: if nesting
Condition: a = 5;
if (a>2)
{
if (a>3)
{
Alert ("123")
}
Else
{
Alert ("456")
}
}
Example: Switch
Condition: var a = 3
Switch (a)
{
Case 1:
Alert ("123");
Break Break (jump, which is the direct output after satisfying the condition, does not execute the following code)
Case 2:
Alert ("456");
Break
Case 3:
Alert ("789");
Break
Default:default (executes this statement when all case is not true on the current face)
Alert ("The input is no longer in range")
}
JavaScript JC scripting language