Document directory
- Explain Method
- New attention Method
- Declaring that the JavaScript signature method is not supported
- Primitive Data Type)
- Special material type
- Material combination
- Material-type artificial intelligence
- Announcement
- Name
-
- The text recorder is unavailable (false summary)
- Available text inspector
- Description of the location where the game logo is located
- Description in the Comment comment Column
- Mouse pointer
- Window
- Input mask for setting the character bit: only numeric characters can be input.
- Set the number of characters in the text field.
- The game logo stays at the bottom of the text in the character field
- Copy the text watermark to the clipboard.
- Retrieve the percentile value in sequence
- Anti-bot set email name list of the host
- Introduction
- Difference in support of the zookeeper
- Announcement
- Basic usage
- Location of javascript in html
- Data Type)
- Variable)
- Object Model DOM
- Tips
- Entrance Exams
- Network Resources
Introduction
JavaScript is a Script statement used by two companies, Netscape Communication and Sun Microsystem, to publish the program connector in IE. No matter whether it is JavaScript or JScript, they all follow the standards proposed by ECMA (European Computer Manufacturer's Association, Zhuzhou E-Commerce Conference, in the beginning, Netscape and microservices both have their own ideas about ECMAScript.
JavaScript is a straightforward Scripting statement based on objects. JavaScript is not a simplified version of other languages (it has nothing to do with Java), and it is not a simplified version of any other software. However, it still has some restrictions. For example, you cannot use it to create some vertical application programs, and it does not have the functions of Case-based authentication and security and authentication.
JavaScript can only be opened on a direct program or "Host", such as Active Server Pages (ASP), Internet Explorer, or Windows Script Host.
JavaScript's declarative syntax is not exactly (Dynamically typed), which means you do not need to explicitly declare the changing data type. JavaScript is a program that is mixed with HTML. It can be used to make immediate special effects on the webpage. It will launch a webpage to your computer, then, the browser automatically downloads JavaScript programs that are mixed with HTML programs to make special effects.
Difference in support of the zookeeper
The table written by javascript on different browsers may be slightly different. In general, IE is highly tolerant of program programming in programming, whereas Mozilla is generally less tolerant.
When you specify a list object on the timer, IE does not specify document, whereas mozilla does not. For example, mozilla must specify document as document. forms. text. value, While IE can be regarded as forms. text. value, but we can use a variable to replace the specified hemp, as shown in
VaR S = "document. Forms ";
S. Text. value = ......; declare the Limit Method
Internal announcement <Script language = "JavaScript"> <! -- Script // --> </Script> |
The anti-bot service is not supported. <! --> Do not make --> A part of JavaScript, you need to add // |
The announcement varies by version. <Script language = "JavaScript"> <Script language = "JavaScript1.1"> <Script language = "JavaScript1.2"> <Script language = "JavaScript1.3"> <Script language = "JavaScript1.4"> <Script language = "JavaScript1.5"> <Script language = "JScript"> |
Embedded Declaration <Script language = "JavaScript" src = "External. js protocol URL"> </Script> |
New attention Method
Internal announcement <Script type = "text/javascript"> <! -- Script // --> </Script> |
The anti-bot service is not supported. <! --> Do not make --> A part of JavaScript, you need to add // |
<SCRIPT type = "text/JavaScript"> </SCRIPT> |
Embedded Declaration <Script type = "text/javascript" src = "External. js protocol URL"> </Script> |
Declaring that the Javascript signature method is not supported
<Noscript> This website uses JavaScript </noscript>
Basic usage
Use JavaScript to show text on the render Manager
Javascript program Logging |
Worker plane |
<Html> <Body><SCRIPT type = "text/JavaScript"> Document. Write ("Hello world! ") </SCRIPT> </Body> </Html> |
Hello World! |
Use JavaScript to expose html on the render Handler
Javascript program Logging |
Worker plane |
<Html> <Body><Script type = "text/javascript"> Document. write ("</Script> </Body> </Html> |
Hello World! |
Location of Javascript in HTML
In the head Section
Javascript program Logging |
Worker plane |
<Html> <Head> <Script type = "text/javascript"> Function message () { Alert ("This alert box was called with the onload event ") } </Script> </Head><Body onload = "message ()"> </Body> </Html> |
|
In the body section
Javascript program Logging |
Worker plane |
<Html> <Head> </Head><Body> <Script type = "text/javascript"> Document. write ("This message is written when the page loads ") </Script> </Body> </Html> |
This message is written when the page loads |
Data Type)
JScript does not explicitly declare a material token. In many cases, JScript will automatically upload images when necessary. For example, if a number is added to the character set by a text string, the number is converted into text.
Primitive Data Type)
String |
A string value is a string of 0 or more Unicode characters (letters, dots, and periods. Bytes can be included in the string of a single string, while a single string can also be included in the string of bytes. |
|
S = "Happy am I; from care I'm free! "; S = '"Avast, ye lubbers! "Roared the technician .'; S = "42 "; S = 'C '; S = ""; |
Data |
The integer and floating point values in Jscript are not clearly divided. Both can be used as the JScript data. (In JScript, all the data words are expressed as floating point values ). Special Value NaN: uses an incorrect item, such as a string or an undefined value, to calculate data. Positive Infinity: When the Positive number is as large as it cannot be displayed in Jscript, this number is used. Negative Infinity: When the numeric value cannot be displayed in Jscript, This numeric value is used. Positive and Negative 0: JScript is divided into Positive 0 and Negative 0. |
|
. 0001; 0.0001; 1e-4; 1.0e-4; 0378; 0377; 0Xff |
Blin |
There can be only two types of Boolean-type memory values: true and false. |
|
Flag = true; flag = false; flag = (x = 2000 ); |
Special material type
The biggest difference between null and undefined is that null is like the number 0, while undefined is like a special value NaN (non-digital ).
The null value and the undefined value are equal after comparison.
Null |
A variable that contains null is "null" or "no object ". An invalid number, String, Boolean value, comment column, or object. You can specify the value of the variable as null to delete the content of the variable but not cancel the change. The null data type of JScript has only one value: null. The null parameter cannot be used as a function or variable name. |
|
|
Undefined |
If the following conditions are met, the undefined value will be returned. That is, use: Non-existent objects The number of changes that have been declared but not specified. Note that you cannot compare the variable with the fixed value, and check whether the variable exists, however, you can check whether this variable type is "undefined ". In the following program example, you can choose whether the designer has declared the variable number x: |
|
If (typeof (x) = "undefined ")................. Var currentCount; Var finalCount = 1 * currentCount; // The finalCount value is NaN, because currentCount is Undefined. |
Material combination
Object |
|
|
Holobby = ["audios", "watching movies"] |
Material-type artificial intelligence
JavaScript is a Dynamically typed statement.
Automatic renewal Principle
- The formula contains numeric strings and uses (+). The formula is equivalent to a string.
- The formula contains numeric strings and uses (-*/...) other operators to calculate the numeric value.
- Null multiplied by any number to 0
- Undefined multiplied by any Number is NaN (Not a Number)
Normalized bytes
- Compress the string as a numeric value: eval ("string ")
- Force the string to specify the base number: parseInt ("string", [base number])
- Force the string to a floating point: parseFloat ("string ")
Variable = identifier declares a type
|
Region changes |
Var variable data name; |
|
Global changes |
Change Data name; |
Method
|
Single announcement |
Var name; |
|
Simultaneous announcement of multiple changes |
VaR name, sex; |
|
The declaration time is passed to the initial value. Otherwise, the value is undefined. |
VaR name = "Peter", sex = "female "; |
|
Although the data type changes, the declaration method is the same |
VaR num = 30, flag = true; |
Name
Provides the name change data and name function data, and provides the criteria of the circle.
Partition size |
VaR X; var x |
The first character must be an ASCII letter (available in both sizes) and a base character (_). Note that the number cannot be the first character. The subsequent character must be a letter, number, or base character. |
VaR _ x; var X_1 |
The proposal for the first word in a word combination should be large enough. |
VaR myfriend; |
Changing the data name cannot be reserved words |
|
There are two ways to render the function that ends with JavaScript using the mark. The text generator is unavailable (false summary) <a href = 'javascript: show_url ("argument ") '> close to function </a> the text recorder is available <a href = "#" onclick = 'show _ URL ("argument"); Return false; '> close to function </a> what are the special program links?
Previous Region |
Javascript: window. History. Go (-1) |
Javascript: window. History. Back () |
Next Region |
Javascript: window. History. Go (1) |
Javascript: window. History. Forward () |
Reorganize |
Javascript: location. Reload () |
|
Print |
Javascript: window. print () |
|
Open a dialog box |
Javascript: window. open () |
|
Closing dialog box |
Javascript: window. close () |
|
Indicates the location of the game tag.
Use title adequacy, such as the home of the old man
Description in the Comment comment Column
The onMouseOver and onMouseOut features are used in combination with the window object model, such as the home of the old man.
Mouse pointer
Use the classification class "a: hover" of the standard, such as a: hover {color: # ffffff; background-color: # 0000ff}
Object Model DOMWindow adequacy
Because windows objects are the top objects in the browser, the window description can be omitted when a script is created.
Sexual intercourse name |
Description |
Can I renew a snapshot? |
Defaultstatus |
When the website operator is completed, the operator text on the operator Column |
Bytes/second |
Status |
Currently, the text in the comment column in the comment window |
Bytes/second |
History |
Signed URL Information |
Bytes |
Length |
Returns the component data in the set. |
Bytes |
Location |
URL address in the website |
Bytes/second |
Name |
Opening window name opening |
Bytes |
Navigator |
Robot Information |
Bytes |
Document |
Website files in the browser |
Bytes |
Opener |
Restore existing objects |
Bytes |
Closed |
Whether or not the existing window is closed |
Bytes |
Parent |
Current parent window |
Bytes |
Self |
Existing window |
Bytes |
Top |
Top Navigation Pane |
Bytes |
Method
Method |
Description |
Alert |
Opening warning dialog box |
Blur |
Loss of network focal points |
Clearinterval |
Disable setinterval |
Cleartimeout |
Disable setTimeout |
Close |
Closing the timer window |
Confirm |
Enable confirmation dialog box |
ExecScript |
Write a script and set it to Javascript |
Focus |
Get the focal point of the website |
Navigate |
Link to another website |
Open |
Added the timer worker window. |
Prompt |
Open dialog box |
Scroll |
Change the X-shift and Y-shift of the webpage window |
Setinterval |
Returns the number of rows in milliseconds. |
SetTimeout |
A fixed number of rows after milliseconds |
ShowHelp |
Open dialog box |
Showmodaldialog |
Opening the modal window |
Event
Event |
Description |
Onload |
When the website is accessed |
OnUnload |
Occurs when the website is opened |
Onfocus |
Triggered when focal points are obtained in the upper window |
Onblur |
Occurs when the cursor window loses its focus |
Onhelp |
When F1 is pressed, it is generated |
Onresize |
When the user completes the window size |
Onscroll |
When users attempt to open a window |
Onerror |
When the website is accessed |
Tip: Set the input mask of the character bit: Only data can be input.
<Script language = "JavaScript" type = "text/javascript"> <! --
Function check_intkey (key ){
If (key> = 48 & key <= 57 ){
Return true;
} Else {
Return false;
}
}
// --> </Script>
<Input type = "text" name = "birthday" onKeypress = "return check_intkey (event. keyCode)"/>
Set the number of characters in the text field.
<Script language = "JavaScript" type = "text/javascript"> <! --
Function fild_valid (obj ){
Var re =/^/d + $ /;
If (obj. value! = ""&&! Re. test (obj. value )){
Alert ("You must enter the number ");
Obj. select ();
Return false;
} Else {
Return true;
}
}
// --> </Script>
<Input type = "text" name = "birthday" onBlur = "fild_valid (this)"/>
The game logo stays at the bottom of the text in the character field
<Script language = "JavaScript" type = "text/javascript"> <! --
Function fild_center (){
Var e = event. srcElement;
Var r = e. createTextRange ();
R. movestart ('character ', E. value. Length );
R. Collapse (true );
R. Select ();
}
// --> </SCRIPT>
<Input type = "text" name = "Address" onclick = "fild_center ()"/>
Copy the text watermark to the clipboard.
<Script language = "JavaScript" type = "text/JavaScript"> <! --
Function addclipboard2 (OBJ ){
VaR r = obj. createTextRange ();
R.exe ccommand ("copy ");
}
// --> </SCRIPT>
<Input type = "text" id = "Address" onclick = "addclipboard2 (this)">
Retrieve the percentile value in sequence
<Script language = "JavaScript" type = "text/JavaScript"> <! --
For (VAR I = 1; I <= 40; I ++ ){
If (typeof (eval ("document. tform. Chk" + I) = "undefined "){
Break;
}
If (eval ("document. tform. Chk" + I + ". Value") = "Y "){
.......................
}
}
// --> </Script>
<Select name = "chk1"> <option value = "Y"> Yes </option> <option value = "N"> NO </option> </select>
<Select name = "chk2"> <option value = "Y"> Yes </option> <option value = "N"> NO </option> </select>
.........
... A pseudo-configuration has a maximum of 40 select statements, or may have less than 40
........
<Select name = "chk40"> <option value = "Y"> Yes </option> <option value = "N"> NO </option> </select>
Anti-bot set email name list of the host
<Script language = "JavaScript" type = "text/javascript"> <! --
Function AntiSpam (Name, Domain ){
Location. href = 'mailto: '+ Name +' @ '+ Domain
}
// --> </Script>
When sending a laptop, the following column calls the Javascript code above.
<A href = "javascript: AntiSpam ('peterju ', 'pchome .com.tw');"> author of zookeeper </a>